[WEB-2092] fix: added unique constraints for project, module and states (#5281)

* fix: added unique constraints

* chore: migration indetaton
This commit is contained in:
Bavisetti Narayan 2024-07-31 19:38:53 +05:30 committed by GitHub
parent 67f2e2fdb2
commit daaa04c6ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 160 additions and 14 deletions

View file

@ -40,6 +40,7 @@ class CycleSerializer(BaseSerializer):
"workspace",
"project",
"owned_by",
"deleted_at",
]

View file

@ -39,6 +39,7 @@ class ModuleSerializer(BaseSerializer):
"updated_by",
"created_at",
"updated_at",
"deleted_at",
]
def to_representation(self, instance):

View file

@ -31,6 +31,7 @@ class ProjectSerializer(BaseSerializer):
"updated_at",
"created_by",
"updated_by",
"deleted_at",
]
def validate(self, data):

View file

@ -404,6 +404,10 @@ class CycleAPIEndpoint(BaseAPIView):
)
# Delete the cycle
cycle.delete()
# Delete the cycle issues
CycleIssue.objects.filter(
cycle_id=self.kwargs.get("pk"),
).delete()
return Response(status=status.HTTP_204_NO_CONTENT)

View file

@ -301,6 +301,10 @@ class ModuleAPIEndpoint(BaseAPIView):
epoch=int(timezone.now().timestamp()),
)
module.delete()
# Delete the module issues
ModuleIssue.objects.filter(
module=pk,
).delete()
return Response(status=status.HTTP_204_NO_CONTENT)