perf: account backup (#9603)

Co-authored-by: feng <1304903146@qq.com>
pull/9604/head
fit2bot 2023-02-17 14:34:51 +08:00 committed by GitHub
parent 40bd197581
commit 419381bd10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -3,13 +3,13 @@
from rest_framework import status, viewsets
from rest_framework.response import Response
from orgs.mixins.api import OrgBulkModelViewSet
from common.const.choices import Trigger
from accounts import serializers
from accounts.tasks import execute_account_backup_plan
from accounts.models import (
AccountBackupAutomation, AccountBackupExecution
)
from accounts.tasks import execute_account_backup_plan
from common.const.choices import Trigger
from orgs.mixins.api import OrgBulkModelViewSet
__all__ = [
'AccountBackupPlanViewSet', 'AccountBackupPlanExecutionViewSet'
@ -39,5 +39,5 @@ class AccountBackupPlanExecutionViewSet(viewsets.ModelViewSet):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
pid = serializer.data.get('plan')
task = execute_account_backup_plan.delay(pid=pid, trigger=Trigger.manual)
task = execute_account_backup_plan.delay(pid=str(pid), trigger=Trigger.manual)
return Response({'task': task.id}, status=status.HTTP_201_CREATED)