From 52d23c319b7bafe3d3a9aa2f28a00f1dfada27e6 Mon Sep 17 00:00:00 2001 From: anishfyle Date: Thu, 18 Jul 2024 14:56:24 +0530 Subject: [PATCH] revert model changes --- apps/workspaces/models.py | 4 ---- apps/workspaces/serializers.py | 16 ---------------- 2 files changed, 20 deletions(-) diff --git a/apps/workspaces/models.py b/apps/workspaces/models.py index 3852c27..a5ca65e 100644 --- a/apps/workspaces/models.py +++ b/apps/workspaces/models.py @@ -231,10 +231,6 @@ class FieldMapping(models.Model): max_length=255, help_text='Class Mapped to Fyle Field', null=True) project_type = models.CharField( max_length=255, help_text='Project Mapped to Fyle Field', null=True) - item_type = models.CharField( - max_length=255, help_text='Item Mapped to Fyle Field', null=True) - custom_fields = ArrayField( - models.CharField(max_length=100), blank=True, default=list) class Meta: db_table = 'field_mapping' diff --git a/apps/workspaces/serializers.py b/apps/workspaces/serializers.py index 0e93f2a..81ef07e 100644 --- a/apps/workspaces/serializers.py +++ b/apps/workspaces/serializers.py @@ -1,11 +1,9 @@ """ Workspace Serializers """ -from typing import Dict from rest_framework import serializers from django_q.tasks import async_task from django.core.cache import cache -from apps.mappings.models import QBDMapping from fyle_rest_auth.helpers import get_fyle_admin from fyle_rest_auth.models import AuthToken @@ -22,12 +20,6 @@ AdvancedSetting ) -def pre_save_field_mapping_trigger(new_field_mapping: Dict, field_mapping: FieldMapping): - items_type = new_field_mapping.get('items_type') - - if items_type and items_type != field_mapping.items_type and items_type in ['PROJECT', 'COST_CENTER']: - QBDMapping.objects.filter(attribute_type=field_mapping.items_type).delete() - class WorkspaceSerializer(serializers.ModelSerializer): """ @@ -141,10 +133,6 @@ def create(self, validated_data): defaults=validated_data ) - """ - Remove the old mappings if the Item is mapped to some other field - """ - pre_save_field_mapping_trigger(validated_data, field_mapping) # Update workspace onboarding state workspace = field_mapping.workspace @@ -152,10 +140,6 @@ def create(self, validated_data): if workspace.onboarding_state == 'FIELD_MAPPINGS': workspace.onboarding_state = 'ADVANCED_SETTINGS' workspace.save() - """ - Sync dimension asyncly - """ - async_task(apps.fyle.actions.sync_fyle_dimensions, workspace.id) return field_mapping