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 193e63c23f..78134c98c1 100644 --- a/apiserver/plane/app/views/cycle/base.py +++ b/apiserver/plane/app/views/cycle/base.py @@ -498,12 +498,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 62c1491619..33fd86f89e 100644 --- a/apiserver/plane/app/views/workspace/draft.py +++ b/apiserver/plane/app/views/workspace/draft.py @@ -61,8 +61,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, )