tgshops-integrations 4.1__tar.gz → 4.3__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.
Files changed (20) hide show
  1. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/PKG-INFO +1 -1
  2. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/setup.py +1 -1
  3. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/middlewares/gateway.py +1 -1
  4. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/client.py +10 -0
  5. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/products_management.py +3 -3
  6. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations.egg-info/PKG-INFO +1 -1
  7. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/README.md +0 -0
  8. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/setup.cfg +0 -0
  9. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/__init__.py +0 -0
  10. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/middlewares/__init__.py +0 -0
  11. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/models/__init__.py +0 -0
  12. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/models/categories.py +0 -0
  13. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/models/products.py +0 -0
  14. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/__init__.py +0 -0
  15. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/categories_management.py +0 -0
  16. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/model_mapping.py +0 -0
  17. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations/nocodb_connector/tables.py +0 -0
  18. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations.egg-info/SOURCES.txt +0 -0
  19. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/tgshops_integrations.egg-info/dependency_links.txt +0 -0
  20. {tgshops_integrations-4.1 → tgshops_integrations-4.3}/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: 4.1
3
+ Version: 4.3
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
@@ -2,7 +2,7 @@ from setuptools import setup,find_packages
2
2
 
3
3
  setup(
4
4
  name='tgshops_integrations',
5
- version='4.1',
5
+ version='4.3',
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  # List your library's dependencies here
@@ -127,7 +127,7 @@ class Gateway(NocodbClient):
127
127
  special_attributes=self.special_attributes,
128
128
  )
129
129
  if current_hash != existing_hash:
130
- await self.product_manager.update_product(product=product)
130
+ await self.product_manager.update_product(product=product,data_check=self.category_manager.categories)
131
131
  else:
132
132
  checked_data = dump_product_data_with_check(
133
133
  data=product,
@@ -92,6 +92,16 @@ class NocodbClient:
92
92
  if response.status_code == 200:
93
93
  return response.json()
94
94
  raise Exception(response.text)
95
+
96
+ async def update_table_record(self, table_name: str, record_id: str, updated_data: dict) -> bool:
97
+ url = f"{self.NOCODB_HOST}/tables/{table_name}/records"
98
+ updated_data["id"] = int(record_id)
99
+ if updated_data["ID"]:
100
+ updated_data.pop("ID")
101
+ response = await self.httpx_client.patch(url, json=updated_data)
102
+ if response.status_code == 200:
103
+ return True
104
+ raise Exception(response.text)
95
105
 
96
106
  async def create_table_record(self, table_name: str, record: dict) -> dict:
97
107
  """
@@ -34,7 +34,7 @@ class ProductManager(NocodbClient):
34
34
  if special_attributes:
35
35
  hash_string = ''.join(attr.description for attr in product.extra_attributes if attr.name.endswith('*'))
36
36
  else:
37
- hash_string = f"{product.external_id}{product.price}{sorted(product.product_properties)}{product.name}{product.description}"
37
+ hash_string = f"{product.external_id}{product.price}{sorted(product.product_properties)}{product.name}{product.description}{product.stock_qty}"
38
38
 
39
39
  return hashlib.sha256(hash_string.encode()).hexdigest()
40
40
 
@@ -98,11 +98,11 @@ class ProductManager(NocodbClient):
98
98
  )
99
99
  return [parse_product_data(record) for record in records]
100
100
 
101
- async def update_product(self, product: ProductModel):
101
+ async def update_product(self, product: ProductModel,data_check=[]):
102
102
  """
103
103
  Updates an existing product in the table.
104
104
  """
105
- data = dump_product_data_with_check(data=product, data_check=self.category_manager.categories)
105
+ data = dump_product_data_with_check(data=product, data_check=data_check)
106
106
  await self.update_table_record(
107
107
  table_name=self.products_table,
108
108
  record_id=product.id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tgshops-integrations
3
- Version: 4.1
3
+ Version: 4.3
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