organizations-local 0.0.24__py3-none-any.whl → 0.0.26__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.
- organizations_local/organizations_local.py +15 -1
- {organizations_local-0.0.24.dist-info → organizations_local-0.0.26.dist-info}/METADATA +1 -1
- organizations_local-0.0.26.dist-info/RECORD +7 -0
- {organizations_local-0.0.24.dist-info → organizations_local-0.0.26.dist-info}/WHEEL +1 -1
- organizations_local-0.0.24.dist-info/RECORD +0 -7
- {organizations_local-0.0.24.dist-info → organizations_local-0.0.26.dist-info}/top_level.txt +0 -0
|
@@ -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?
|
|
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,12 @@ 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
|
+
sync_conflict_resolution = SyncConflictResolution()
|
|
188
|
+
update_status: UpdateStatus = sync_conflict_resolution.get_update_status_by_where(
|
|
189
|
+
schema_name=DEFAULT_SCHEMA_NAME, view_table_name="organization_profile_view",
|
|
190
|
+
where="profile_id = %s", params=(main_profile_id,), select_clause_value="updated_timestamp",
|
|
191
|
+
remote_last_modified_timestamp=last_modified_timestamp)
|
|
192
|
+
return update_status
|
|
@@ -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=MrrHr5l1MSC1xxASIbPiFU3niOHABhHB_NCNMz-abOo,9935
|
|
4
|
+
organizations_local-0.0.26.dist-info/METADATA,sha256=g4OH3yyJ43wE0qUTzcqGzbNkfx-QKrNbSHcKx7uH-8k,654
|
|
5
|
+
organizations_local-0.0.26.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
|
|
6
|
+
organizations_local-0.0.26.dist-info/top_level.txt,sha256=Y8wRcm3jFTyMdysBub_P8iqX1VOMS0ohUxA1GQdngFU,20
|
|
7
|
+
organizations_local-0.0.26.dist-info/RECORD,,
|
|
@@ -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.24.dist-info/METADATA,sha256=i7KsqAqUxqbXNApPF-c64jK4-Gxew7K7MSehfLj6PyU,654
|
|
5
|
-
organizations_local-0.0.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
6
|
-
organizations_local-0.0.24.dist-info/top_level.txt,sha256=Y8wRcm3jFTyMdysBub_P8iqX1VOMS0ohUxA1GQdngFU,20
|
|
7
|
-
organizations_local-0.0.24.dist-info/RECORD,,
|
|
File without changes
|