diff --git a/apiserver/plane/api/views/cycle.py b/apiserver/plane/api/views/cycle.py index 5fa959b267c..882692dac04 100644 --- a/apiserver/plane/api/views/cycle.py +++ b/apiserver/plane/api/views/cycle.py @@ -404,11 +404,7 @@ def delete(self, request, slug, project_id, pk): 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 e3620762fd5..e021c4ba1ab 100644 --- a/apiserver/plane/app/views/cycle/base.py +++ b/apiserver/plane/app/views/cycle/base.py @@ -490,12 +490,9 @@ def destroy(self, request, slug, project_id, pk): 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 d116c421474..ae7db2a4012 100644 --- a/apiserver/plane/app/views/workspace/draft.py +++ b/apiserver/plane/app/views/workspace/draft.py @@ -60,8 +60,8 @@ def get_queryset(self): .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, )