Skip to content

Commit

Permalink
revert model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anishfyle committed Jul 18, 2024
1 parent 9d6be94 commit 52d23c3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
4 changes: 0 additions & 4 deletions apps/workspaces/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 0 additions & 16 deletions apps/workspaces/serializers.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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):
"""
Expand Down Expand Up @@ -141,21 +133,13 @@ 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

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

Expand Down

0 comments on commit 52d23c3

Please sign in to comment.