From 3c3fc7cd6ddce5267ceccd420824999cc107d930 Mon Sep 17 00:00:00 2001 From: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com> Date: Mon, 21 Oct 2024 13:02:20 +0530 Subject: [PATCH] chore: draft issue listing (#5874) --- apiserver/plane/api/views/cycle.py | 6 +----- apiserver/plane/app/views/cycle/base.py | 9 +++------ apiserver/plane/app/views/workspace/draft.py | 4 ++-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/apiserver/plane/api/views/cycle.py b/apiserver/plane/api/views/cycle.py index 5fa959b267..882692dac0 100644 --- a/apiserver/plane/api/views/cycle.py +++ b/apiserver/plane/api/views/cycle.py @@ -404,11 +404,7 @@ class CycleAPIEndpoint(BaseAPIView): epoch=int(timezone.now().timestamp()), ) # Delete the cycle - cycle.delete() - # Delete the cycle issues - CycleIssue.objects.filter( - cycle_id=self.kwargs.get("pk"), - ).delete() + cycle.delete(soft=False) # Delete the user favorite cycle UserFavorite.objects.filter( entity_type="cycle", diff --git a/apiserver/plane/app/views/cycle/base.py b/apiserver/plane/app/views/cycle/base.py index e3620762fd..e021c4ba1a 100644 --- a/apiserver/plane/app/views/cycle/base.py +++ b/apiserver/plane/app/views/cycle/base.py @@ -490,12 +490,9 @@ class CycleViewSet(BaseViewSet): notification=True, origin=request.META.get("HTTP_ORIGIN"), ) - # Delete the cycle - cycle.delete() - # Delete the cycle issues - CycleIssue.objects.filter( - cycle_id=self.kwargs.get("pk"), - ).delete() + # TODO: Soft delete the cycle break the onetoone relationship with cycle issue + cycle.delete(soft=False) + # Delete the user favorite cycle UserFavorite.objects.filter( user=request.user, diff --git a/apiserver/plane/app/views/workspace/draft.py b/apiserver/plane/app/views/workspace/draft.py index d116c42147..ae7db2a401 100644 --- a/apiserver/plane/app/views/workspace/draft.py +++ b/apiserver/plane/app/views/workspace/draft.py @@ -60,8 +60,8 @@ class WorkspaceDraftIssueViewSet(BaseViewSet): .annotate( cycle_id=Case( When( - issue_cycle__cycle__deleted_at__isnull=True, - then=F("issue_cycle__cycle_id"), + draft_issue_cycle__cycle__deleted_at__isnull=True, + then=F("draft_issue_cycle__cycle_id"), ), default=None, )