contact-person-profile-csv-imp-local 0.0.24__py3-none-any.whl → 0.0.25__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.
@@ -349,50 +349,41 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
349
349
 
350
350
  # insert link contact_location
351
351
  # The location is in contact_dict
352
- location_results = self.__insert_link_contact_location(
353
- contact_dict=contact_dict) or [{}]
354
- contact_dict["location_id"] = location_results[0].get(
355
- "location_id")
352
+ location_results = self.__insert_link_contact_location(contact_dict=contact_dict) or [{}]
353
+ contact_dict["location_id"] = location_results[0].get("location_id")
356
354
  contact_dict["country_id"] = location_results[0].get("country_id")
357
355
 
358
356
  # insert link contact_group
359
- self.__insert_link_contact_groups(
360
- contact_dict=contact_dict)
357
+ self.__insert_link_contact_groups(contact_dict=contact_dict)
361
358
 
362
359
  # insert link contact_persons
363
- contact_person_result_dict = self.__insert_link_contact_persons(
364
- contact_dict=contact_dict) or {}
360
+ contact_person_result_dict = self.__insert_link_contact_persons(contact_dict=contact_dict) or {}
365
361
  contact_dict["person_id"] = contact_person_result_dict.get("person_id")
366
362
 
367
363
  # insert link contact_profiles
368
364
  contact_profile_info = self.__insert_contact_profiles(
369
365
  contact_dict=contact_dict) or {}
370
366
 
371
- profile_id = contact_profile_info.get("profile_id")
367
+ contact_dict["profiles_ids_list"] = contact_profile_info.get("profiles_ids_list")
372
368
 
373
369
  # insert organization-profile
374
370
  self.__insert_organization_profile(
375
- organization_id=organization_id, profile_id=profile_id)
371
+ organization_id=organization_id, profiles_ids_list=contact_dict["profiles_ids_list"])
376
372
 
377
373
  # insert link contact_email_addresses
378
- self.__insert_link_contact_email_addresses(
379
- contact_dict=contact_dict, profile_id=profile_id)
374
+ self.__insert_link_contact_email_addresses(contact_dict=contact_dict)
380
375
 
381
376
  # insert link contact_notes
382
- CSVToContactPersonProfile.__insert_link_contact_notes_and_text_blocks(
383
- contact_dict=contact_dict, profile_id=profile_id)
377
+ CSVToContactPersonProfile.__insert_link_contact_notes_and_text_blocks(contact_dict=contact_dict)
384
378
 
385
379
  # insert link contact_phones
386
- self.__insert_link_contact_phones(
387
- contact_dict=contact_dict, profile_id=profile_id)
380
+ self.__insert_link_contact_phones(contact_dict=contact_dict)
388
381
 
389
382
  # inset link contact_user_externals
390
- self.__insert_link_contact_user_external(
391
- contact_dict=contact_dict)
383
+ self.__insert_link_contact_user_external(contact_dict=contact_dict)
392
384
 
393
385
  # insert link contact_internet_domains
394
- self.__insert_link_contact_domains(
395
- contact_dict=contact_dict)
386
+ self.__insert_link_contact_domains(contact_dict=contact_dict)
396
387
 
397
388
  importer_id = self.__insert_importer(
398
389
  contact_id=contact_dict.get("contact_id"), location_id=contact_dict.get("location_id") or DEFAULT_LOCATION_ID,
@@ -446,15 +437,15 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
446
437
 
447
438
  return organization_dict
448
439
 
449
- def __insert_organization_profile(self, organization_id: int, profile_id: int) -> int or None:
440
+ def __insert_organization_profile(self, organization_id: int, profiles_ids_list: list[int]) -> list[int] or None:
450
441
 
451
- if not organization_id or not profile_id:
442
+ if not organization_id or not profiles_ids_list:
452
443
  return None
453
444
 
454
- organization_profile_id = self.organization_profiles.insert_mapping_if_not_exists(
455
- organization_id=organization_id, profile_id=profile_id)
445
+ organization_profiles_ids = self.organization_profiles.insert_multiple_mappings_if_not_exists(
446
+ organizations_ids=[organization_id], profiles_ids=profiles_ids_list)
456
447
 
457
- return organization_profile_id
448
+ return organization_profiles_ids
458
449
 
459
450
  def __insert_link_contact_groups(self, contact_dict: dict) -> list:
460
451
  contact_id = contact_dict.get("contact_id")
@@ -490,7 +481,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
490
481
 
491
482
  return contact_person_results_dict
492
483
 
493
- def __insert_link_contact_email_addresses(self, contact_dict: dict, profile_id: int = None) -> list[int]:
484
+ # 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
485
+ def __insert_link_contact_email_addresses(self, contact_dict: dict) -> list[int]:
494
486
  email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
495
487
  contact_dict=contact_dict)
496
488
  contact_email_addresses = self.contact_email_addresses
@@ -498,37 +490,30 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
498
490
  for email_address in email_addresses:
499
491
  contact_email_address_id = contact_email_addresses.insert_contact_and_link_to_email_address(
500
492
  contact_dict=contact_dict,
501
- contact_email_address_str=email_address,
502
- profile_id=profile_id
493
+ contact_email_address_str=email_address
503
494
  )
504
495
  contact_email_address_ids.append(contact_email_address_id)
505
496
 
506
497
  return contact_email_address_ids
507
498
 
508
499
  @staticmethod
509
- def __insert_link_contact_notes_and_text_blocks(
510
- *, contact_dict: dict, profile_id: int) -> int or None:
500
+ def __insert_link_contact_notes_and_text_blocks(*, contact_dict: dict) -> int or None:
511
501
  if not contact_dict.get("notes"):
512
502
  return
513
503
  # TODO: I think we should change ContactNotesLocal - send the args to the method and not the class
514
- if profile_id is None:
515
- # TODO: check if this method works with profile_id = None
516
- profile_id = DEFAULT_PROFILE_ID
517
- contact_notes = ContactNotesLocal(
518
- contact_dict=contact_dict, profile_id=profile_id)
504
+ contact_notes = ContactNotesLocal(contact_dict=contact_dict)
519
505
  insert_information = contact_notes.insert_contact_notes_text_block() or {}
520
506
  contact_note_id = insert_information.get("contact_note_id")
521
507
  return contact_note_id
522
508
 
523
- def __insert_link_contact_phones(self, contact_dict: dict, profile_id: int) -> list[int]:
509
+ def __insert_link_contact_phones(self, contact_dict: dict) -> list[int]:
524
510
  phone_numbers = self.contacts_local.get_contact_phone_numbers_from_contact_dict(
525
511
  contact_dict=contact_dict)
526
512
  contact_phone_ids = []
527
513
  for phone_number_original in phone_numbers:
528
514
  process_phone_result_dict = self.contact_phone.insert_contact_and_link_to_existing_or_new_phone(
529
515
  contact_dict=contact_dict,
530
- phone_number_original=phone_number_original,
531
- profile_id=profile_id
516
+ phone_number_original=phone_number_original
532
517
  )
533
518
  contact_phone_ids.append(process_phone_result_dict.get("contact_phone_id"))
534
519
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: contact-person-profile-csv-imp-local
3
- Version: 0.0.24
3
+ Version: 0.0.25
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
@@ -1,7 +1,7 @@
1
- contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=9SlwE-jfTtxVZ62yIJbf6G85uVFhl1DxTUapbS54ctw,40564
1
+ contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=07T3o9jOvxt2HCaNDp7WzUW4d59gzYuNtVe4tpkKNiQ,40348
2
2
  contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=eE0Bg2dCPrmG72K20k0_KOckc61C9cGSgH0Zgae_lbk,957
4
- contact_person_profile_csv_imp_local-0.0.24.dist-info/METADATA,sha256=nbT0_trufQwvlavWU-xdeYtg6iAcV5njRen9Lk6s-fQ,1450
5
- contact_person_profile_csv_imp_local-0.0.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- contact_person_profile_csv_imp_local-0.0.24.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
7
- contact_person_profile_csv_imp_local-0.0.24.dist-info/RECORD,,
4
+ contact_person_profile_csv_imp_local-0.0.25.dist-info/METADATA,sha256=3IBwX4gtMOsI-KOtD1sjwJ7kSKCLg-BB-_zKb7pNV70,1450
5
+ contact_person_profile_csv_imp_local-0.0.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ contact_person_profile_csv_imp_local-0.0.25.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
7
+ contact_person_profile_csv_imp_local-0.0.25.dist-info/RECORD,,