tgshops-integrations 2.1__tar.gz → 2.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/PKG-INFO +1 -1
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/setup.py +1 -1
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/products.py +20 -9
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/PKG-INFO +1 -1
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/README.md +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/setup.cfg +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/__init__.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/middlewares/__init__.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/middlewares/gateway.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/__init__.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/categories.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/products.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/__init__.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/categories.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/client.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/model_mapping.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/nocodb_connector/tables.py +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/SOURCES.txt +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/dependency_links.txt +0 -0
- {tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tgshops_integrations
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.2
|
4
4
|
Summary: Library is intended to provide the integration of the external service or CRM system with the TelegramShops/It allows to configure the relationship between NocoDB list of the products used further to display in the shop/As a resultss the products can be synchronized and updated uppon the request.
|
5
5
|
Home-page: https://git.the-devs.com/virtual-shops/shop-system/shop-backend-integrations/integration-library/integration-library
|
6
6
|
Author: Dimi Latoff
|
@@ -6,7 +6,7 @@ from tgshops_integrations.models.products import ProductModel, ProductModel
|
|
6
6
|
from tgshops_integrations.nocodb_connector.client import custom_key_builder, NocodbClient
|
7
7
|
from tgshops_integrations.nocodb_connector.model_mapping import dump_product_data,dump_product_data_with_check, get_pagination_info, ID_FIELD, \
|
8
8
|
parse_product_data, PRODUCT_CATEGORY_ID_LOOKUP_FIELD, PRODUCT_NAME_FIELD, PRODUCT_PRICE_FIELD, \
|
9
|
-
PRODUCT_STOCK_FIELD
|
9
|
+
PRODUCT_STOCK_FIELD,PRODUCT_EXTERNAL_ID,PRODUCT_IMAGES_LOOKUP_FIELD
|
10
10
|
|
11
11
|
from tgshops_integrations.nocodb_connector.tables import *
|
12
12
|
from loguru import logger
|
@@ -15,18 +15,18 @@ import hashlib
|
|
15
15
|
|
16
16
|
class ProductManager(NocodbClient):
|
17
17
|
|
18
|
-
def __init__(self,table_id=None,logging=False,NOCODB_HOST=None,NOCODB_API_KEY=None,SOURCE=None):
|
19
|
-
super().__init__(NOCODB_HOST=NOCODB_HOST,NOCODB_API_KEY=NOCODB_API_KEY,SOURCE=SOURCE)
|
18
|
+
def __init__(self, table_id=None, logging=False, NOCODB_HOST=None, NOCODB_API_KEY=None, SOURCE=None):
|
19
|
+
super().__init__(NOCODB_HOST=NOCODB_HOST, NOCODB_API_KEY=NOCODB_API_KEY, SOURCE=SOURCE)
|
20
20
|
self.NOCODB_HOST = NOCODB_HOST
|
21
21
|
self.NOCODB_API_KEY = NOCODB_API_KEY
|
22
|
-
self.SOURCE=SOURCE
|
23
|
-
self.logging=logging
|
22
|
+
self.SOURCE = SOURCE
|
23
|
+
self.logging = logging
|
24
24
|
self.required_fields = [PRODUCT_NAME_FIELD, PRODUCT_PRICE_FIELD]
|
25
25
|
self.projection = []
|
26
|
-
self.external_categories={}
|
27
|
-
self.products_table=table_id
|
28
|
-
self.actual_products=[]
|
29
|
-
self.columns=[]
|
26
|
+
self.external_categories = {}
|
27
|
+
self.products_table = table_id
|
28
|
+
self.actual_products = []
|
29
|
+
self.columns = []
|
30
30
|
|
31
31
|
def hash_product(self,product,special_attributes=False):
|
32
32
|
if special_attributes:
|
@@ -154,9 +154,20 @@ class ProductManager(NocodbClient):
|
|
154
154
|
|
155
155
|
@cached(ttl=60, key_builder=custom_key_builder)
|
156
156
|
async def update_attributes(self,products:List[ProductModel]):
|
157
|
+
system_attributes = [PRODUCT_EXTERNAL_ID,PRODUCT_IMAGES_LOOKUP_FIELD]
|
158
|
+
attributes=await self.get_table_meta(table_name=self.products_table)
|
159
|
+
self.columns =[item['title'].lower() for item in attributes.get('columns', [])]
|
160
|
+
|
161
|
+
#TODO Requires Validation
|
162
|
+
for attribute_name in system_attributes:
|
163
|
+
if attribute.lower() not in self.columns:
|
164
|
+
response =await self.create_table_column(table_name=self.products_table,name=attribute_name)
|
165
|
+
logger.info(f"Created attribute: {attribute_name}")
|
166
|
+
|
157
167
|
for item in products:
|
158
168
|
attributes=await self.get_table_meta(table_name=self.products_table)
|
159
169
|
self.columns =[item['title'].lower() for item in attributes.get('columns', [])]
|
170
|
+
|
160
171
|
for attribute in item.extra_attributes:
|
161
172
|
if attribute.name.rstrip().lower() not in self.columns:
|
162
173
|
response =await self.create_table_column(table_name=self.products_table,name=attribute.name.lower())
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tgshops-integrations
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.2
|
4
4
|
Summary: Library is intended to provide the integration of the external service or CRM system with the TelegramShops/It allows to configure the relationship between NocoDB list of the products used further to display in the shop/As a resultss the products can be synchronized and updated uppon the request.
|
5
5
|
Home-page: https://git.the-devs.com/virtual-shops/shop-system/shop-backend-integrations/integration-library/integration-library
|
6
6
|
Author: Dimi Latoff
|
File without changes
|
File without changes
|
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/middlewares/__init__.py
RENAMED
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/middlewares/gateway.py
RENAMED
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/__init__.py
RENAMED
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/categories.py
RENAMED
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations/models/products.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{tgshops_integrations-2.1 → tgshops_integrations-2.2}/tgshops_integrations.egg-info/top_level.txt
RENAMED
File without changes
|