Skip to content

Commit

Permalink
Move the admin subscription after the adv. settings (#626)
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 committed Jun 25, 2024
1 parent 8b404c1 commit 571c51d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion apps/workspaces/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def update_or_create_workspace(user, access_token):

FyleCredential.objects.update_or_create(refresh_token=auth_tokens.refresh_token, workspace_id=workspace.id, cluster_domain=cluster_domain)
async_task('apps.workspaces.tasks.async_add_admins_to_workspace', workspace.id, user.user_id)
async_task('apps.workspaces.tasks.async_create_admin_subcriptions', workspace.id)

return workspace

Expand Down
2 changes: 2 additions & 0 deletions apps/workspaces/apis/advanced_configurations/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.mappings.models import GeneralMapping
from apps.workspaces.apis.advanced_configurations.triggers import AdvancedConfigurationsTriggers
Expand Down Expand Up @@ -98,6 +99,7 @@ def update(self, instance, validated):
instance.onboarding_state = 'COMPLETE'
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
20 changes: 20 additions & 0 deletions sql/scripts/024-remove-admin-subscription.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
\copy (select fyle_org_id from workspaces where onboarding_state = 'COMPLETE') to '/Users/hrishabh/Desktop/orgs_qbo.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_qbo.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 '%quickbooks-api%';

0 comments on commit 571c51d

Please sign in to comment.