channel-app 0.0.157a10__py3-none-any.whl → 0.0.157a12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- channel_app/app/order/service.py +598 -364
- channel_app/app/product/service.py +392 -238
- channel_app/app/product_image/service.py +214 -134
- channel_app/app/product_price/service.py +390 -240
- channel_app/app/product_stock/service.py +285 -203
- channel_app/app/setup/service.py +133 -79
- channel_app/logs/services.py +1 -1
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/METADATA +1 -1
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/RECORD +11 -11
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/WHEEL +0 -0
- {channel_app-0.0.157a10.dist-info → channel_app-0.0.157a12.dist-info}/top_level.txt +0 -0
channel_app/app/setup/service.py
CHANGED
@@ -3,100 +3,154 @@ from typing import List
|
|
3
3
|
from channel_app.core import settings
|
4
4
|
from channel_app.core.data import CategoryTreeDto, ErrorReportDto, AttributeDto
|
5
5
|
from channel_app.core.settings import OmnitronIntegration, ChannelIntegration
|
6
|
+
from channel_app.logs.services import LogService
|
6
7
|
from channel_app.omnitron.constants import ContentType
|
7
8
|
|
8
9
|
|
9
10
|
class SetupService(object):
|
10
11
|
def create_or_update_category_tree_and_nodes(self, is_success_log=False):
|
11
|
-
|
12
|
+
log_service = LogService()
|
13
|
+
log_service.create_flow(name="(Setup) Create or Update Category Tree and Nodes")
|
14
|
+
|
15
|
+
try:
|
16
|
+
with OmnitronIntegration(
|
12
17
|
content_type=ContentType.category_tree.value) as omnitron_integration:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
channel_integration = ChannelIntegration()
|
19
|
+
with log_service.step("get_category_tree_and_nodes"):
|
20
|
+
category_tree, report, _ = channel_integration.do_action(
|
21
|
+
key='get_category_tree_and_nodes',
|
22
|
+
batch_request=omnitron_integration.batch_request)
|
17
23
|
|
18
|
-
|
19
|
-
|
24
|
+
category_tree: CategoryTreeDto
|
25
|
+
report: ErrorReportDto
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
if report and (is_success_log or not report.is_ok):
|
28
|
+
with log_service.step("create_error_report"):
|
29
|
+
omnitron_integration.do_action(
|
30
|
+
key='create_error_report',
|
31
|
+
objects=report)
|
25
32
|
|
26
|
-
|
27
|
-
|
28
|
-
|
33
|
+
with log_service.step("create_or_update_category_tree_and_nodes"):
|
34
|
+
omnitron_integration.do_action(
|
35
|
+
key='create_or_update_category_tree_and_nodes',
|
36
|
+
objects=category_tree)
|
37
|
+
except Exception as fatal:
|
38
|
+
log_service.add_exception(fatal)
|
39
|
+
raise
|
40
|
+
finally:
|
41
|
+
log_service.save()
|
29
42
|
|
30
43
|
def create_or_update_category_attributes(self, is_success_log=False):
|
31
|
-
|
32
|
-
|
33
|
-
channel_integration = ChannelIntegration()
|
34
|
-
category_integration_actions = omnitron_integration.do_action(
|
35
|
-
key='get_category_ids')
|
36
|
-
|
37
|
-
for category_ia in category_integration_actions:
|
38
|
-
if not category_ia.remote_id:
|
39
|
-
continue
|
40
|
-
|
41
|
-
category, report, data = channel_integration.do_action(
|
42
|
-
key='get_category_attributes',
|
43
|
-
objects=category_ia,
|
44
|
-
batch_request=omnitron_integration.batch_request
|
45
|
-
)
|
46
|
-
if report and (is_success_log or not report.is_ok):
|
47
|
-
omnitron_integration.do_action(
|
48
|
-
key='create_error_report',
|
49
|
-
objects=report)
|
44
|
+
log_service = LogService()
|
45
|
+
log_service.create_flow(name="Create or Update Category Attributes")
|
50
46
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
try:
|
48
|
+
with OmnitronIntegration(
|
49
|
+
content_type=ContentType.attribute.value) as omnitron_integration:
|
50
|
+
channel_integration = ChannelIntegration()
|
51
|
+
with log_service.step("get_category_ids"):
|
52
|
+
category_integration_actions = omnitron_integration.do_action(
|
53
|
+
key='get_category_ids')
|
54
|
+
|
55
|
+
for category_ia in category_integration_actions:
|
56
|
+
if not category_ia.remote_id:
|
57
|
+
continue
|
58
|
+
|
59
|
+
with log_service.step("get_category_attributes"):
|
60
|
+
category, report, data = channel_integration.do_action(
|
61
|
+
key='get_category_attributes',
|
62
|
+
objects=category_ia,
|
63
|
+
batch_request=omnitron_integration.batch_request
|
64
|
+
)
|
65
|
+
if report and (is_success_log or not report.is_ok):
|
66
|
+
with log_service.step("create_error_report"):
|
67
|
+
omnitron_integration.do_action(
|
68
|
+
key='create_error_report',
|
69
|
+
objects=report)
|
70
|
+
|
71
|
+
category = category if category.attributes else None
|
72
|
+
with log_service.step("create_or_update_category_attributes"):
|
73
|
+
omnitron_integration.do_action(
|
74
|
+
key='create_or_update_category_attributes',
|
75
|
+
objects=(category_ia, category))
|
76
|
+
except Exception as fatal:
|
77
|
+
log_service.add_exception(fatal)
|
78
|
+
raise
|
79
|
+
finally:
|
80
|
+
log_service.save()
|
55
81
|
|
56
82
|
def create_or_update_attributes(self, is_success_log=False):
|
57
|
-
|
83
|
+
log_service = LogService()
|
84
|
+
log_service.create_flow(name="Create or Update Attributes")
|
85
|
+
|
86
|
+
try:
|
87
|
+
with OmnitronIntegration(
|
58
88
|
content_type=ContentType.attribute.value) as omnitron_integration:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
"
|
91
|
-
"remote_id": attr_value.remote_id
|
89
|
+
channel_integration = ChannelIntegration()
|
90
|
+
with log_service.step("get_attributes"):
|
91
|
+
attributes, report, data = channel_integration.do_action(
|
92
|
+
key='get_attributes',
|
93
|
+
batch_request=omnitron_integration.batch_request
|
94
|
+
)
|
95
|
+
|
96
|
+
attributes: List[AttributeDto]
|
97
|
+
reports: ErrorReportDto
|
98
|
+
|
99
|
+
if report and (is_success_log or not report.is_ok):
|
100
|
+
with log_service.step("create_error_report"):
|
101
|
+
omnitron_integration.do_action(
|
102
|
+
key='create_error_report',
|
103
|
+
objects=report)
|
104
|
+
|
105
|
+
for attribute in attributes:
|
106
|
+
with log_service.step("create_or_update_channel_attribute"):
|
107
|
+
attr = omnitron_integration.do_action(
|
108
|
+
key="create_or_update_channel_attribute",
|
109
|
+
objects={"name": attribute.name,
|
110
|
+
"remote_id": attribute.remote_id},
|
111
|
+
)[0]
|
112
|
+
|
113
|
+
with log_service.step("get_or_create_channel_attribute_schema"):
|
114
|
+
omnitron_integration.do_action(
|
115
|
+
key="get_or_create_channel_attribute_schema",
|
116
|
+
objects={"name": f"{settings.OMNITRON_CHANNEL_ID} {attribute.name} Schema"},
|
117
|
+
)
|
118
|
+
for attr_value in attribute.values:
|
119
|
+
with log_service.step("create_or_update_channel_attribute_value", metadata={
|
120
|
+
"attribute_name": attr_value.name,
|
121
|
+
"remote_id": attr_value.remote_id
|
122
|
+
}):
|
123
|
+
omnitron_integration.do_action(
|
124
|
+
key="create_or_update_channel_attribute_value",
|
125
|
+
objects={
|
126
|
+
"attribute": attr.pk,
|
127
|
+
"label": attr_value.name,
|
128
|
+
"value": attr_value.remote_id,
|
129
|
+
"remote_id": attr_value.remote_id})
|
130
|
+
except Exception as fatal:
|
131
|
+
log_service.add_exception(fatal)
|
132
|
+
raise
|
133
|
+
finally:
|
134
|
+
log_service.save()
|
92
135
|
|
93
136
|
def update_channel_conf_schema(self):
|
94
|
-
|
95
|
-
|
96
|
-
channel_integration = ChannelIntegration()
|
97
|
-
schema, _, _ = channel_integration.do_action(
|
98
|
-
key='get_channel_conf_schema',
|
99
|
-
batch_request=omnitron_integration.batch_request)
|
137
|
+
log_service = LogService()
|
138
|
+
log_service.create_flow(name="Update Channel Conf Schema")
|
100
139
|
|
101
|
-
|
102
|
-
|
140
|
+
try:
|
141
|
+
with OmnitronIntegration(
|
142
|
+
content_type=ContentType.channel.value) as omnitron_integration:
|
143
|
+
channel_integration = ChannelIntegration()
|
144
|
+
with log_service.step("get_channel_conf_schema"):
|
145
|
+
schema, _, _ = channel_integration.do_action(
|
146
|
+
key='get_channel_conf_schema',
|
147
|
+
batch_request=omnitron_integration.batch_request)
|
148
|
+
|
149
|
+
with log_service.step("update_channel_conf_schema"):
|
150
|
+
omnitron_integration.do_action(key="update_channel_conf_schema",
|
151
|
+
objects=schema)
|
152
|
+
except Exception as fatal:
|
153
|
+
log_service.add_exception(fatal)
|
154
|
+
raise
|
155
|
+
finally:
|
156
|
+
log_service.save()
|
channel_app/logs/services.py
CHANGED
@@ -3,17 +3,17 @@ channel_app/alembic.ini,sha256=wUP23krSqffP4Gmo-dXuoceqwi8f7RJaC--7cR-Sfsg,3751
|
|
3
3
|
channel_app/migrate.py,sha256=jbeWNvgtSbGk9dKXTgM_rGr1NZf3trEfjJvKVhvNmHE,532
|
4
4
|
channel_app/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
channel_app/app/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
channel_app/app/order/service.py,sha256=
|
6
|
+
channel_app/app/order/service.py,sha256=DZyBOkXSF6xTZzzSWFSrKuWK0eAqaMcYp4jbNG_5vWA,31952
|
7
7
|
channel_app/app/product/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
channel_app/app/product/service.py,sha256=
|
8
|
+
channel_app/app/product/service.py,sha256=i_vw303fxX0zYtNssInct_BRFjpvHIn7YfRMgmh2K5w,18059
|
9
9
|
channel_app/app/product_image/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
channel_app/app/product_image/service.py,sha256=
|
10
|
+
channel_app/app/product_image/service.py,sha256=RMc-avIcTT-MlWvtU6Np_Gcq5FDJ3m9hbCclQYEVsiQ,10372
|
11
11
|
channel_app/app/product_price/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
channel_app/app/product_price/service.py,sha256=
|
12
|
+
channel_app/app/product_price/service.py,sha256=mF2HCj9vyuAcj524ZcUhLE08wU49-Nl_dWzY7g7sDKI,21300
|
13
13
|
channel_app/app/product_stock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
channel_app/app/product_stock/service.py,sha256=
|
14
|
+
channel_app/app/product_stock/service.py,sha256=8wewnWmjNycUEVaPHLLzpX4q_x9uqf2P39JV1Ke-okw,18992
|
15
15
|
channel_app/app/setup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
|
-
channel_app/app/setup/service.py,sha256=
|
16
|
+
channel_app/app/setup/service.py,sha256=Pymo7-m6ygcUdJKaDFUHYljTIXqZleeiZ-XAkOWuoxs,7386
|
17
17
|
channel_app/channel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
channel_app/channel/integration.py,sha256=fDx5nxa6w-4gMucU7xo_OTOkqPHdBUHeDtuzeaDJlXE,3769
|
19
19
|
channel_app/channel/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -44,7 +44,7 @@ channel_app/database/migrations/versions/6d5ae5b9c541_create_initial_tables.py,s
|
|
44
44
|
channel_app/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
45
|
channel_app/logs/encoders.py,sha256=6CVgtkV7DrjxGpNXCJgT9bn9B2Ep0lHgtm-0ES7A57I,703
|
46
46
|
channel_app/logs/enums.py,sha256=If6ZjwRTerbJypYI8WjdsleHR7FjlV-TP2nBppFVEc4,214
|
47
|
-
channel_app/logs/services.py,sha256=
|
47
|
+
channel_app/logs/services.py,sha256=aHop-XqjWeuRXUsPLeH1UTWfxj1xmP2YEFX1W5wGW34,7175
|
48
48
|
channel_app/omnitron/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
channel_app/omnitron/batch_request.py,sha256=S8IHtbI1RtVLbnOwtfXSmkrREGp8wUYW2E-eu5omwyY,3550
|
50
50
|
channel_app/omnitron/constants.py,sha256=WZR6k_k2zZfN7lfi1ZLv1PphsHIq_LiZgw6Nd6LduvE,2793
|
@@ -71,7 +71,7 @@ channel_app/omnitron/commands/tests/test_product_images.py,sha256=y6tmiJ00kd2GTq
|
|
71
71
|
channel_app/omnitron/commands/tests/test_product_prices.py,sha256=5HPX9PmjGw6gk3oNrwtWLqdrOkfeNx1mYP-pYwOesZU,3496
|
72
72
|
channel_app/omnitron/commands/tests/test_product_stocks.py,sha256=q4RGlrCNUUJyN5CBL1fzrvdd4Q3xt816mbMRQT0XEd0,3496
|
73
73
|
channel_app/omnitron/commands/tests/test_products.py,sha256=uj5KLaubY3XNu0hidOH-u-Djfboe81Hj7-lP--01Le0,103494
|
74
|
-
channel_app-0.0.
|
75
|
-
channel_app-0.0.
|
76
|
-
channel_app-0.0.
|
77
|
-
channel_app-0.0.
|
74
|
+
channel_app-0.0.157a12.dist-info/METADATA,sha256=fm6s0x7G50DuU8lUe1uwHAiq4TOMLrYC1CG3vq0lpbI,442
|
75
|
+
channel_app-0.0.157a12.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
76
|
+
channel_app-0.0.157a12.dist-info/top_level.txt,sha256=JT-gM6L5Cwxr1xEoN7NHrREDs-d6iGFGfRnK-NrJ3tU,12
|
77
|
+
channel_app-0.0.157a12.dist-info/RECORD,,
|
File without changes
|
File without changes
|