channel-app 0.0.157a13__tar.gz → 0.0.157a14__tar.gz
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-0.0.157a13 → channel_app-0.0.157a14}/PKG-INFO +1 -1
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/reports/services.py +115 -1
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app.egg-info/PKG-INFO +1 -1
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/setup.py +1 -1
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/.gitignore +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/.vscode/settings.json +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/Makefile +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/Procfile-dist +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/README.md +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/akinon.json-dist +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/bitbucket-pipelines.yml +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/build.sh-dist +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/alembic.ini +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/order/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/order/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_image/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_image/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_price/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_price/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_stock/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/product_stock/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/setup/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/app/setup/service.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/orders/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/orders/orders.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_categories.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_images.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_prices.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_stocks.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/products.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/setup.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/integration.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/clients.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/commands.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/data.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/integration.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/products.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/settings.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/tests.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/core/utilities.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/migrations/README +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/migrations/env.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/migrations/script.py.mako +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/migrations/versions/6d5ae5b9c541_create_initial_tables.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/models.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/services.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/logs/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/logs/encoders.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/logs/enums.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/logs/services.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/migrate.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/batch_request.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/batch_requests.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/error_reports.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/integration_actions.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/addresses.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/cargo_companies.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/customers.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/orders.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_categories.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_images.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_prices.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_stocks.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/products.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/setup.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_orders.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_product_images.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_product_prices.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_product_stocks.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_products.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/constants.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/exceptions.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/integration.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/reports/__init__.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app.egg-info/SOURCES.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app.egg-info/dependency_links.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app.egg-info/requires.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app.egg-info/top_level.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/Makefile +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/make.bat +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/requirements.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/architecture.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/command_reference.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/conf.py +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/flows.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/images/async.png +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/images/batch_request_state_machine.png +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/images/sync.png +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/index.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/installation_and_usage.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/terminology.rst +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/requirements-dev.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/requirements.txt +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/setup.cfg +0 -0
- {channel_app-0.0.157a13 → channel_app-0.0.157a14}/tox.ini +0 -0
@@ -4,7 +4,7 @@ from channel_app.core.settings import OmnitronIntegration
|
|
4
4
|
from channel_app.logs.services import LogService
|
5
5
|
from channel_app.omnitron.integration import OmnitronIntegration as IOmnitronIntegration
|
6
6
|
from channel_app.omnitron.constants import ContentType
|
7
|
-
from omnisdk.omnitron.models import Product
|
7
|
+
from omnisdk.omnitron.models import Product, ProductStock
|
8
8
|
|
9
9
|
|
10
10
|
class ReportService:
|
@@ -182,3 +182,117 @@ class ReportService:
|
|
182
182
|
raise
|
183
183
|
finally:
|
184
184
|
log_service.save()
|
185
|
+
|
186
|
+
|
187
|
+
class DashboardService:
|
188
|
+
@staticmethod
|
189
|
+
def get_total_sku_from_catalog(limit: int = 10) -> List[Product]:
|
190
|
+
"""
|
191
|
+
Get total SKU from catalog.
|
192
|
+
"""
|
193
|
+
|
194
|
+
log_service = LogService()
|
195
|
+
log_service.create_flow(name="Get Total SKU from Catalog")
|
196
|
+
|
197
|
+
try:
|
198
|
+
with OmnitronIntegration(
|
199
|
+
content_type=ContentType.product.value,
|
200
|
+
) as omnitron_integration:
|
201
|
+
omnitron_integration: IOmnitronIntegration
|
202
|
+
|
203
|
+
with log_service.step("get_total_sku_from_catalog"):
|
204
|
+
products: List[Product] = omnitron_integration.do_action(
|
205
|
+
key="get_inserted_products",
|
206
|
+
objects={
|
207
|
+
"limit": limit,
|
208
|
+
},
|
209
|
+
)
|
210
|
+
|
211
|
+
return products
|
212
|
+
except Exception as fatal:
|
213
|
+
log_service.add_exception(fatal)
|
214
|
+
raise
|
215
|
+
finally:
|
216
|
+
log_service.save()
|
217
|
+
|
218
|
+
@staticmethod
|
219
|
+
def get_total_sku_on_sale_from_catalog(limit: int = 10) -> List[Product]:
|
220
|
+
"""
|
221
|
+
Get total SKU on sale from catalog.
|
222
|
+
"""
|
223
|
+
|
224
|
+
log_service = LogService()
|
225
|
+
log_service.create_flow(name="Get Total SKU on Sale from Catalog")
|
226
|
+
|
227
|
+
try:
|
228
|
+
with OmnitronIntegration(
|
229
|
+
content_type=ContentType.product.value,
|
230
|
+
) as omnitron_integration:
|
231
|
+
omnitron_integration: IOmnitronIntegration
|
232
|
+
|
233
|
+
with log_service.step("get_total_sku_on_sale_from_catalog"):
|
234
|
+
products: List[Product] = omnitron_integration.do_action(
|
235
|
+
key="get_inserted_products",
|
236
|
+
params={
|
237
|
+
"catalogitem__isnull": False,
|
238
|
+
},
|
239
|
+
objects={
|
240
|
+
"limit": limit,
|
241
|
+
},
|
242
|
+
)
|
243
|
+
|
244
|
+
return products
|
245
|
+
except Exception as fatal:
|
246
|
+
log_service.add_exception(fatal)
|
247
|
+
raise
|
248
|
+
finally:
|
249
|
+
log_service.save()
|
250
|
+
|
251
|
+
@staticmethod
|
252
|
+
def get_product_stocks_from_catalog() -> List[ProductStock]:
|
253
|
+
"""
|
254
|
+
Get product stocks from catalog.
|
255
|
+
"""
|
256
|
+
log_service = LogService()
|
257
|
+
log_service.create_flow(name="Get Product Stocks from Catalog")
|
258
|
+
|
259
|
+
try:
|
260
|
+
with OmnitronIntegration(
|
261
|
+
content_type=ContentType.product_stock.value,
|
262
|
+
) as omnitron_integration:
|
263
|
+
omnitron_integration: IOmnitronIntegration
|
264
|
+
|
265
|
+
with log_service.step("get_product_stocks_from_catalog"):
|
266
|
+
stocks = omnitron_integration.do_action(
|
267
|
+
key="get_product_stocks",
|
268
|
+
objects={
|
269
|
+
"limit": 9999,
|
270
|
+
},
|
271
|
+
)
|
272
|
+
|
273
|
+
return stocks
|
274
|
+
except Exception as fatal:
|
275
|
+
log_service.add_exception(fatal)
|
276
|
+
raise
|
277
|
+
finally:
|
278
|
+
log_service.save()
|
279
|
+
|
280
|
+
@staticmethod
|
281
|
+
def get_total_stock_from_product_stocks(product_stocks: List[ProductStock]) -> int:
|
282
|
+
"""
|
283
|
+
Get total stock from catalog.
|
284
|
+
"""
|
285
|
+
log_service = LogService()
|
286
|
+
log_service.create_flow(name="Get Total Stock from Catalog")
|
287
|
+
|
288
|
+
try:
|
289
|
+
total_stock = 0
|
290
|
+
for stock in product_stocks:
|
291
|
+
total_stock += stock.productstock.stock if stock.productstock else 0
|
292
|
+
|
293
|
+
return total_stock
|
294
|
+
except Exception as fatal:
|
295
|
+
log_service.add_exception(fatal)
|
296
|
+
raise
|
297
|
+
finally:
|
298
|
+
log_service.save()
|
@@ -5,7 +5,7 @@ with open("README.md") as f:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="channel_app",
|
8
|
-
version="0.0.
|
8
|
+
version="0.0.157a14", # alpha prerelease
|
9
9
|
packages=find_packages(),
|
10
10
|
url="https://github.com/akinon/channel_app",
|
11
11
|
description="Channel app for Sales Channels",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/orders/__init__.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/orders/orders.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_categories.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_images.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_prices.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/channel/commands/product_stocks.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/database/migrations/script.py.mako
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/batch_requests.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/error_reports.py
RENAMED
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/__init__.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/addresses.py
RENAMED
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/customers.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/orders/orders.py
RENAMED
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_images.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_prices.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/product_stocks.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/__init__.py
RENAMED
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/channel_app/omnitron/commands/tests/test_orders.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{channel_app-0.0.157a13 → channel_app-0.0.157a14}/docs/source/images/batch_request_state_machine.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|