Skip to content

Commit

Permalink
Move the admin subscription after the adv. settings (#599)
Browse files Browse the repository at this point in the history
* Move the admin subscription after the adv. settings

* fix sql script

* fix typo
  • Loading branch information
Hrishabh17 authored Jun 25, 2024
1 parent 9ab25b4 commit 5d5cdf2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/workspaces/apis/advanced_settings/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from rest_framework import serializers
from django_q.tasks import async_task

from apps.workspaces.models import Configuration, Workspace, WorkspaceSchedule
from apps.mappings.models import GeneralMapping
Expand Down Expand Up @@ -183,6 +184,7 @@ def update(self, instance, validated):
instance.save()

AdvancedConfigurationsTriggers.post_to_integration_settings(instance.id, True)
async_task('apps.workspaces.tasks.async_create_admin_subcriptions', instance.id)

return instance

Expand Down
1 change: 0 additions & 1 deletion apps/workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def post(self, request):
workspace_id=workspace.id,
cluster_domain=cluster_domain
)
async_task('apps.workspaces.tasks.async_create_admin_subcriptions', workspace.id)

return Response(
data=WorkspaceSerializer(workspace).data,
Expand Down
19 changes: 19 additions & 0 deletions scripts/sql/scripts/028-remove-admin-subscription.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
\copy (select fyle_org_id from workspaces where onboarding_state = 'COMPLETE') to '/Users/hrishabh/Desktop/orgs_netsuite.csv' WITH CSV HEADER;


-- Fyle DB
rollback;
begin;

create temp table temp_orgs (
org_id TEXT
);

--- update path here
\copy temp_orgs(org_id) from '/Users/hrishabh/Desktop/orgs_netsuite.csv' WITH CSV HEADER;

update platform_schema.admin_subscriptions set is_enabled = 'f' where org_id not in (
select org_id from temp_orgs
)
and is_enabled = 't'
and webhook_url ilike '%netsuite-api%';

0 comments on commit 5d5cdf2

Please sign in to comment.