contact-person-profile-csv-imp-local 0.0.35__py3-none-any.whl → 0.0.36__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.
@@ -173,16 +173,16 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
173
173
  # TODO Align the parameters between import-contact-csv with sync-google-contact
174
174
  # TODO Can we please add groups_str parameter to both sync-google-contact and import-contact-csv where we add all contacts to those groups?
175
175
  def insert_update_contact_from_csv(
176
- self, *, data_source_type_name: str, file_name: str = None, user_external_username: str, system_name: str = None,
176
+ self, *, data_source_type_id: int, file_name: str = None, user_external_username: str, system_id: int = None,
177
177
  # TODO Add support to criteria_set_id
178
178
  directory_name: str = None, csv_path: str = None, start_index: int = 0, end_index: int = None,
179
179
  groups_dicts: list[dict] = None, profile_id: int = None) -> dict:
180
180
  """
181
181
  Insert contacts from CSV file to the database
182
- :param data_source_type_name: The data source name
182
+ :param data_source_type_id: The data source id
183
183
  :param file_name: The CSV file name
184
184
  :param user_external_username: The user external username
185
- :param system_name: The system name
185
+ :param system_id: The system id
186
186
  :param user_external_username: The user external username
187
187
  :param groups_dicts: The groups list
188
188
  :param profile_id: The profile ID
@@ -192,16 +192,12 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
192
192
  :param end_index: The end index
193
193
  :return:
194
194
  """
195
- data_source_type_id = DataSources().get_data_source_type_id_by_name(data_source_type_name)
195
+ data_source_type_name = DataSources().get_data_source_name_by_id(data_source_type_id)
196
196
  profile_id_by_email_address = ProfilesLocal().select_one_value_by_column_and_value(
197
197
  schema_name="profile", view_table_name="profile_view",
198
198
  select_clause_value="profile_id", column_name="profile.main_email_address",
199
199
  column_value=user_external_username)
200
- system_id = CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
201
- if system_name:
202
- system_id = self.select_one_value_by_column_and_value(
203
- schema_name="system", view_table_name="system_ml_view",
204
- select_clause_value="system_id", column_name="title", column_value=system_name)
200
+ system_id = system_id or CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
205
201
  self.set_schema(schema_name="field")
206
202
  profile_id = profile_id or profile_id_by_email_address
207
203
  self.groups_list = groups_dicts if groups_dicts else []
@@ -451,9 +447,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
451
447
  contact_id=contact_dict.get("contact_id"), location_id=contact_dict.get("location_id") or DEFAULT_LOCATION_ID,
452
448
  user_external_id=user_external_id,
453
449
  data_source_instance_id=data_source_instance_id,
454
- data_source_type_id=data_source_type_id,
455
- data_source_type_name=contact_dict.get("source")
456
- )
450
+ data_source_type_id=data_source_type_id)
457
451
  return importer_id
458
452
 
459
453
  # TODO Move this method to LocationsLocal
@@ -584,7 +578,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
584
578
 
585
579
  return contact_person_results_dict
586
580
 
587
- # TODO This method is confusing me as based on the name I was expected to to have two parameters contact_dict and email_addresses but we are sending profile_id, please explain or fix
581
+ # TODO This method is confusing me as based on the name I was expected to to have two parameters
582
+ # contact_dict and email_addresses but we are sending profile_id, please explain or fix
588
583
  def __insert_link_contact_email_addresses(self, contact_dict: dict) -> list[int]:
589
584
  email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
590
585
  contact_dict=contact_dict)
@@ -675,19 +670,18 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
675
670
 
676
671
  # TODO merge this method with the method in google-contact-sync
677
672
  def __insert_importer(self, contact_id: int, location_id: int, user_external_id: int,
678
- data_source_type_id: int, data_source_instance_id: int,
679
- data_source_type_name: str) -> int:
673
+ data_source_type_id: int, data_source_instance_id: int) -> int:
680
674
  # TODO: Shall we consider the url of csv's as the following? Use Sql2Code. Use const enum
681
- if data_source_type_name == CSVToContactPersonProfileConstants.GOOGLE_CSV_DATA_SOURCE_TYPE_NAME:
675
+ if data_source_type_id == CSVToContactPersonProfileConstants.GOOGLE_CSV_DATA_SOURCE_TYPE_ID:
682
676
  url = "www.google.com"
683
- elif data_source_type_name == CSVToContactPersonProfileConstants.OUTLOOK_CSV_DATA_SOURCE_TYPE_NAME:
677
+ elif data_source_type_id == CSVToContactPersonProfileConstants.OUTLOOK_CSV_DATA_SOURCE_TYPE_ID:
684
678
  url = "www.outlook.com"
685
- elif data_source_type_name == CSVToContactPersonProfileConstants.LINKEDIN_CSV_DATA_SOURCE_TYPE_NAME:
679
+ elif data_source_type_id == CSVToContactPersonProfileConstants.LINKEDIN_CSV_DATA_SOURCE_TYPE_ID:
686
680
  url = "www.linkedin.com"
687
681
  # TODO Please change all Magic Numbers to data generated by Sql2Code
688
- elif data_source_type_name == CSVToContactPersonProfileConstants.BGU_COURSE_CSV_DATA_SOURCE_TYPE_NAME:
682
+ elif data_source_type_id == CSVToContactPersonProfileConstants.BGU_COURSE_CSV_DATA_SOURCE_TYPE_ID:
689
683
  url = None
690
- elif data_source_type_name == CSVToContactPersonProfileConstants.RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_NAME:
684
+ elif data_source_type_id == CSVToContactPersonProfileConstants.RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_ID:
691
685
  url = None
692
686
  else:
693
687
  raise ValueError("data_source_type_id is not valid")
@@ -892,7 +886,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
892
886
 
893
887
  @staticmethod
894
888
  def fix_contact_dict_by_data_source_type(contact_dict: dict) -> dict:
895
- if contact_dict.get('source') == CSVToContactPersonProfileConstants.RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_NAME:
889
+ if contact_dict.get('data_source_type_id') == CSVToContactPersonProfileConstants.RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_ID:
896
890
  if contact_dict.get('phone1'):
897
891
  cellphone_number = contact_dict.get('phone1')
898
892
  if cellphone_number.startswith('0'):
@@ -20,8 +20,8 @@ class CSVToContactPersonProfileConstants:
20
20
  'developer_email': DEVELOPER_EMAIL
21
21
  }
22
22
 
23
- GOOGLE_CSV_DATA_SOURCE_TYPE_NAME = 'Google Contact CSV File'
24
- LINKEDIN_CSV_DATA_SOURCE_TYPE_NAME = 'Linkedin Contact CSV File'
25
- OUTLOOK_CSV_DATA_SOURCE_TYPE_NAME = 'Outlook Contact CSV File'
26
- BGU_COURSE_CSV_DATA_SOURCE_TYPE_NAME = 'BGU Course CSV File'
27
- RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_NAME = 'Rishon Muni Exhibitor CSV File'
23
+ GOOGLE_CSV_DATA_SOURCE_TYPE_ID = 16
24
+ LINKEDIN_CSV_DATA_SOURCE_TYPE_ID = 18
25
+ OUTLOOK_CSV_DATA_SOURCE_TYPE_ID = 17
26
+ BGU_COURSE_CSV_DATA_SOURCE_TYPE_ID = 57
27
+ RISHON_MUNI_EXHIBITOR_CSV_DATA_SOURCE_TYPE_ID = 60
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: contact-person-profile-csv-imp-local
3
- Version: 0.0.35
3
+ Version: 0.0.36
4
4
  Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
5
5
  Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
6
6
  Author: Circles
@@ -0,0 +1,7 @@
1
+ contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=NWUnlpuq82R6_sGWO81QT9TNEg_eBg0TTzTiXIPxV1I,49321
2
+ contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=SsMFKnI7y3P_kQxH21rxKnX7H4MZlemBy5vuv_Ns_a4,1180
4
+ contact_person_profile_csv_imp_local-0.0.36.dist-info/METADATA,sha256=7p6KDl0c2jjJfGEVUl_mSe1IJJEN1cKIGgn02Ya-Juk,1481
5
+ contact_person_profile_csv_imp_local-0.0.36.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ contact_person_profile_csv_imp_local-0.0.36.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
7
+ contact_person_profile_csv_imp_local-0.0.36.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=ZXPVnc_-iuqzidpicisiBAbaaMxUATZ1CSSscbLeFbg,49712
2
- contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=hlZiM-gHlVNkBvpNcILlyZE1A25Zutnb3TGO1jcdzWc,1311
4
- contact_person_profile_csv_imp_local-0.0.35.dist-info/METADATA,sha256=uqp041W_GgsFW49pVB7-k5N6gQWFUJvOEaIzaqMb-24,1481
5
- contact_person_profile_csv_imp_local-0.0.35.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- contact_person_profile_csv_imp_local-0.0.35.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
7
- contact_person_profile_csv_imp_local-0.0.35.dist-info/RECORD,,