import --> tag batch inner dashboard
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from django.db.models import Sum, Q, Count
|
from django.db.models import Sum, Q, Count, QuerySet
|
||||||
from django.db.models.functions import Coalesce
|
from django.db.models.functions import Coalesce
|
||||||
|
|
||||||
from apps.authentication.models import Organization
|
from apps.authentication.models import Organization
|
||||||
@@ -11,12 +11,12 @@ class TagBatchService:
|
|||||||
services of tag batch
|
services of tag batch
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def tag_batch_main_dashboard(self, org: Organization = None):
|
def tag_batch_main_dashboard(self, org: Organization = None, batch: QuerySet[TagBatch] = None):
|
||||||
"""
|
"""
|
||||||
dashboard data of batch main page
|
dashboard data of batch main page
|
||||||
"""
|
"""
|
||||||
|
|
||||||
qs = TagBatch.objects.select_related('organization')
|
qs = TagBatch.objects.select_related('organization') if not batch else batch
|
||||||
|
|
||||||
if org.type.key != 'ADM':
|
if org.type.key != 'ADM':
|
||||||
child_orgs = get_all_org_child(org) # noqa
|
child_orgs = get_all_org_child(org) # noqa
|
||||||
|
|||||||
@@ -350,6 +350,27 @@ class TagBatchViewSet(BaseViewSet, SoftDeleteMixin, DynamicSearchMixin, TagBatch
|
|||||||
|
|
||||||
return Response(dashboard_data, status=status.HTTP_200_OK)
|
return Response(dashboard_data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@action(
|
||||||
|
methods=['get'],
|
||||||
|
detail=True,
|
||||||
|
url_name='inner_dashboard',
|
||||||
|
url_path='inner_dashboard',
|
||||||
|
name='inner_dashboard',
|
||||||
|
)
|
||||||
|
def inner_dashboard(self, request, pk=None):
|
||||||
|
"""
|
||||||
|
dashboard of tag batches inner page by id
|
||||||
|
"""
|
||||||
|
|
||||||
|
org = get_organization_by_user(request.user)
|
||||||
|
|
||||||
|
dashboard_data = self.tag_batch_main_dashboard(
|
||||||
|
org=org,
|
||||||
|
batch=self.queryset.filter(id=self.get_object().id)
|
||||||
|
)
|
||||||
|
|
||||||
|
return Response(dashboard_data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def destroy(self, request, pk=None, *args, **kwargs):
|
def destroy(self, request, pk=None, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
soft delete batch with tag items
|
soft delete batch with tag items
|
||||||
|
|||||||
Reference in New Issue
Block a user