[WEB-2092] fix: added unique constraints for project, module and states (#5281)
* fix: added unique constraints * chore: migration indetaton
This commit is contained in:
parent
67f2e2fdb2
commit
daaa04c6ea
17 changed files with 160 additions and 14 deletions
|
|
@ -250,7 +250,6 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||
removed_modules = request.data.get("removed_modules", [])
|
||||
project = Project.objects.get(pk=project_id)
|
||||
|
||||
|
||||
if modules:
|
||||
_ = ModuleIssue.objects.bulk_create(
|
||||
[
|
||||
|
|
@ -284,7 +283,7 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||
]
|
||||
|
||||
for module_id in removed_modules:
|
||||
module_issue = ModuleIssue.objects.get(
|
||||
module_issue = ModuleIssue.objects.filter(
|
||||
workspace__slug=slug,
|
||||
project_id=project_id,
|
||||
module_id=module_id,
|
||||
|
|
@ -297,7 +296,7 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||
issue_id=str(issue_id),
|
||||
project_id=str(project_id),
|
||||
current_instance=json.dumps(
|
||||
{"module_name": module_issue.module.name}
|
||||
{"module_name": module_issue.first().module.name}
|
||||
),
|
||||
epoch=int(timezone.now().timestamp()),
|
||||
notification=True,
|
||||
|
|
@ -308,7 +307,7 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||
return Response({"message": "success"}, status=status.HTTP_201_CREATED)
|
||||
|
||||
def destroy(self, request, slug, project_id, module_id, issue_id):
|
||||
module_issue = ModuleIssue.objects.get(
|
||||
module_issue = ModuleIssue.objects.filter(
|
||||
workspace__slug=slug,
|
||||
project_id=project_id,
|
||||
module_id=module_id,
|
||||
|
|
@ -321,7 +320,7 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||
issue_id=str(issue_id),
|
||||
project_id=str(project_id),
|
||||
current_instance=json.dumps(
|
||||
{"module_name": module_issue.module.name}
|
||||
{"module_name": module_issue.first().module.name}
|
||||
),
|
||||
epoch=int(timezone.now().timestamp()),
|
||||
notification=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue