Skip to content

Commit

Permalink
Defaulted sync method to custom_segment (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 authored Mar 27, 2024
1 parent a72d5b8 commit 268aabc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
1 change: 1 addition & 0 deletions apps/mappings/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@
'DEPARTMENT': 'departments',
'LOCATION': 'locations',
'CLASS': 'classifications',
'custom_segments': 'custom_segments',
}
2 changes: 1 addition & 1 deletion apps/mappings/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def construct_tasks_and_chain_import_fields_to_fyle(workspace_id: int):
if mapping_settings:
for mapping_setting in mapping_settings:
if mapping_setting.source_field in ALLOWED_SOURCE_FIELDS or mapping_setting.is_custom:
destination_sync_methods = [SYNC_METHODS[mapping_setting.destination_field.upper()]]
destination_sync_methods = [SYNC_METHODS.get(mapping_setting.destination_field.upper()), 'custom_segments']

if mapping_setting.destination_field == 'PROJECT':
destination_sync_methods.append(SYNC_METHODS['CUSTOMER'])
Expand Down
2 changes: 1 addition & 1 deletion apps/mappings/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def run_pre_mapping_settings_triggers(sender, instance: MappingSetting, **kwargs
destination_field=instance.destination_field,
sync_after=last_successful_run_at,
sdk_connection=netsuite_connection,
destination_sync_methods=[SYNC_METHODS[instance.destination_field.upper()]]
destination_sync_methods=[SYNC_METHODS.get(instance.destination_field.upper()), 'custom_segments']
)

fyle_credentials = FyleCredential.objects.get(workspace_id=workspace_id)
Expand Down
21 changes: 1 addition & 20 deletions apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,7 @@ def sync_netsuite_attribute(netsuite_attribute_type: str, workspace_id: int):
workspace_id=workspace_id
)

if netsuite_attribute_type == 'LOCATION':
ns_connection.sync_locations()

elif netsuite_attribute_type == 'PROJECT':
ns_connection.sync_projects()
ns_connection.sync_customers()

elif netsuite_attribute_type == 'DEPARTMENT':
ns_connection.sync_departments()

elif netsuite_attribute_type == 'CLASS':
ns_connection.sync_classifications()

elif netsuite_attribute_type == 'TAX_ITEM':
ns_connection.sync_tax_items()

elif netsuite_attribute_type == 'VENDOR':
ns_connection.sync_vendors()

elif netsuite_attribute_type == 'EMPLOYEE':
if netsuite_attribute_type == 'EMPLOYEE':
ns_connection.sync_employees()

else:
Expand Down
2 changes: 1 addition & 1 deletion apps/netsuite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def post(self, request, *args, **kwargs):
for mapping_setting in mapping_settings:
if mapping_setting.source_field in ALLOWED_SOURCE_FIELDS or mapping_setting.is_custom:
# run new_schedule_or_delete_fyle_import_tasks
destination_sync_methods = [SYNC_METHODS[mapping_setting.destination_field.upper()]]
destination_sync_methods = [SYNC_METHODS.get(mapping_setting.destination_field.upper()), 'custom_segments']

if mapping_setting.destination_field == 'PROJECT':
destination_sync_methods.append(SYNC_METHODS['CUSTOMER'])
Expand Down

0 comments on commit 268aabc

Please sign in to comment.