Skip to content

Commit

Permalink
api PR comments commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyle authored and Fyle committed Sep 15, 2023
1 parent 113c52f commit 746685b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
12 changes: 12 additions & 0 deletions apps/fyle/actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from apps.mappings.connector import PlatformConnector


def sync_fyle_dimensions(attribute_type: str, workspace_id: int):
"""
Sync Attributes will be called for syncing the attribute's data from the fyle to qbd db
"""

qbd_connection = PlatformConnector(workspace_id=workspace_id)

if attribute_type == 'CORPORATE_CARD':
qbd_connection.sync_corporate_card()
4 changes: 2 additions & 2 deletions apps/fyle/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from rest_framework.response import Response
from rest_framework.views import status

from apps.mappings.tasks import sync_attributes
from .actions import sync_fyle_dimensions


class SyncFyleDimensionView(generics.ListCreateAPIView):
Expand All @@ -15,6 +15,6 @@ def post(self, request, *args, **kwargs):
"""
Sync Data From Fyle
"""
sync_attributes('CORPORATE_CARD', workspace_id=kwargs['workspace_id'])
sync_fyle_dimensions('CORPORATE_CARD', workspace_id=kwargs['workspace_id'])

return Response(status=status.HTTP_200_OK)
12 changes: 0 additions & 12 deletions apps/mappings/tasks.py
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
from .connector import PlatformConnector


def sync_attributes(attribute_type: str, workspace_id: int):
"""
Sync Attributes will be called for syncing the attribute's data from the fyle to qbd db
"""

qbd_connection = PlatformConnector(workspace_id=workspace_id)

if attribute_type == 'CORPORATE_CARD':
qbd_connection.sync_corporate_card()
1 change: 0 additions & 1 deletion apps/mappings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from quickbooks_desktop_api.utils import assert_valid, LookupFieldMixin

from .models import QBDMapping
from .tasks import sync_attributes
from .actions import get_qbd_mapping_stat


Expand Down

0 comments on commit 746685b

Please sign in to comment.