organizations-local 0.0.25__py3-none-any.whl → 0.0.27__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.
@@ -1,4 +1,6 @@
1
1
  from database_mysql_local.generic_crud_ml import GenericCRUDML
2
+ from database_mysql_local.constants import UpdateStatus
3
+ from database_mysql_local.sync_conflict_resolution import SyncConflictResolution
2
4
  from language_remote.lang_code import LangCode
3
5
  from logger_local.MetaLogger import MetaLogger
4
6
  from user_context_remote.user_context import UserContext
@@ -94,10 +96,12 @@ class OrganizationsLocal(GenericCRUDML, metaclass=MetaLogger,
94
96
 
95
97
  def upsert_organization(self, organization_dict: dict, order_by: str = None) -> dict:
96
98
  lang_code = LangCode.detect_lang_code_restricted(text=organization_dict.get('title'),
99
+ #TODO the lang code can be in the organization_dict or in the UserContext, I'm not sure English as default is correct
97
100
  default_lang_code=LangCode.ENGLISH)
98
101
  organization_ml_dict = self._clean_organization_ml_dict(organization_dict)
99
102
  organization_dict = self._clean_organization_dict(organization_dict)
100
103
 
104
+ # TODO Why do we need to do this if outside of GenericCrud in every entity, can we move this "if" into the Generic Crud method? Can we avoid two methods? The parameters of the two methods are the same?
101
105
  if "(" and ")" in organization_dict.get('title', ''):
102
106
  organization_id, organzation_ml_ids_list = GenericCRUDML.upsert_value_with_abbreviations(
103
107
  self, data_ml_dict=organization_ml_dict, lang_code=lang_code,
@@ -110,6 +114,7 @@ class OrganizationsLocal(GenericCRUDML, metaclass=MetaLogger,
110
114
  ml_table_name=DEFAULT_ML_TABLE_NAME, order_by=order_by)
111
115
  organzation_ml_ids_list = [organzation_ml_id]
112
116
 
117
+ #TODO upsert_result_dict
113
118
  upsert_information = {
114
119
  "organization_id": organization_id,
115
120
  "organization_ml_ids_list": organzation_ml_ids_list
@@ -118,7 +123,7 @@ class OrganizationsLocal(GenericCRUDML, metaclass=MetaLogger,
118
123
  return upsert_information
119
124
 
120
125
  def update_organization(self, *, organization_id: int, organization_ml_id: int, organization_dict: dict) -> None:
121
- # TODO: should we have such method in CRUD ML? same for delete
126
+ # TODO: should we have such a method in CRUD ML? Same for delete
122
127
  organization_ml_dict = self._clean_organization_ml_dict(organization_dict)
123
128
  organization_ml_dict["organization_id"] = organization_id
124
129
  organization_dict = self._clean_organization_dict(organization_dict)
@@ -176,3 +181,14 @@ class OrganizationsLocal(GenericCRUDML, metaclass=MetaLogger,
176
181
  test_organization_id = self.get_test_entity_id(
177
182
  entity_name="organization", insert_function=self.insert_organization)
178
183
  return test_organization_id
184
+
185
+ # If we add the support of multiple organizations per contact, We will have to fix this method
186
+ def get_update_status(self, *, last_modified_timestamp: str, main_profile_id: int) -> UpdateStatus:
187
+ if main_profile_id is None:
188
+ return UpdateStatus.UPDATE_CIRCLEZ
189
+ sync_conflict_resolution = SyncConflictResolution()
190
+ update_status: UpdateStatus = sync_conflict_resolution.get_update_status_by_where(
191
+ schema_name=DEFAULT_SCHEMA_NAME, view_table_name="organization_profile_view",
192
+ where="profile_id = %s", params=(main_profile_id,), select_clause_value="updated_timestamp",
193
+ remote_last_modified_timestamp=last_modified_timestamp)
194
+ return update_status
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: organizations-local
3
- Version: 0.0.25
3
+ Version: 0.0.27
4
4
  Summary: PyPI Package for Circles organizations-local Python
5
5
  Home-page: https://github.com/circles-zone/organizations-local-python-package
6
6
  Author: Circles
@@ -0,0 +1,7 @@
1
+ organizations_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ organizations_local/organizations_constants.py,sha256=pxyAMmv4BFCfzyDsF92vImLdazA7_0ecKyVmOR9peEE,900
3
+ organizations_local/organizations_local.py,sha256=ika3TEYhrVB66o7wRAAZMQsBX-N7i7bxwLPYl4s4Hk8,10018
4
+ organizations_local-0.0.27.dist-info/METADATA,sha256=rcx-kV7etxfpamYS87qE9OjtenEYlK4D9L5goPVSAI8,654
5
+ organizations_local-0.0.27.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
6
+ organizations_local-0.0.27.dist-info/top_level.txt,sha256=Y8wRcm3jFTyMdysBub_P8iqX1VOMS0ohUxA1GQdngFU,20
7
+ organizations_local-0.0.27.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,7 +0,0 @@
1
- organizations_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- organizations_local/organizations_constants.py,sha256=pxyAMmv4BFCfzyDsF92vImLdazA7_0ecKyVmOR9peEE,900
3
- organizations_local/organizations_local.py,sha256=Ode5MaVaWYngofNUIJlGdeuLpavXoinrZ43sKiFTlOo,8731
4
- organizations_local-0.0.25.dist-info/METADATA,sha256=WFjtXdQGUmwsd7uMuUwia93uimGyR_2CCGuz6MUxeXM,654
5
- organizations_local-0.0.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- organizations_local-0.0.25.dist-info/top_level.txt,sha256=Y8wRcm3jFTyMdysBub_P8iqX1VOMS0ohUxA1GQdngFU,20
7
- organizations_local-0.0.25.dist-info/RECORD,,