forked from github/plane
Merge pull request #56 from pablohashescobar/refactor/module_cycle_issue
refactor: make both cycle issue and module issue view consistent
This commit is contained in:
commit
443334774e
@ -70,7 +70,7 @@ class CycleIssueViewSet(BaseViewSet):
|
|||||||
def create(self, request, slug, project_id, cycle_id):
|
def create(self, request, slug, project_id, cycle_id):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
issues = request.data.get("issue", [])
|
issues = request.data.get("issues", [])
|
||||||
|
|
||||||
if not len(issues):
|
if not len(issues):
|
||||||
return Response(
|
return Response(
|
||||||
|
@ -15,7 +15,7 @@ from plane.api.serializers import (
|
|||||||
ModuleIssueSerializer,
|
ModuleIssueSerializer,
|
||||||
)
|
)
|
||||||
from plane.api.permissions import ProjectEntityPermission
|
from plane.api.permissions import ProjectEntityPermission
|
||||||
from plane.db.models import Module, ModuleIssue, Project
|
from plane.db.models import Module, ModuleIssue, Project, Issue
|
||||||
|
|
||||||
|
|
||||||
class ModuleViewSet(BaseViewSet):
|
class ModuleViewSet(BaseViewSet):
|
||||||
@ -80,7 +80,6 @@ class ModuleViewSet(BaseViewSet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleIssueViewSet(BaseViewSet):
|
class ModuleIssueViewSet(BaseViewSet):
|
||||||
|
|
||||||
serializer_class = ModuleIssueSerializer
|
serializer_class = ModuleIssueSerializer
|
||||||
@ -126,6 +125,11 @@ class ModuleIssueViewSet(BaseViewSet):
|
|||||||
module = Module.objects.get(
|
module = Module.objects.get(
|
||||||
workspace__slug=slug, project_id=project_id, pk=module_id
|
workspace__slug=slug, project_id=project_id, pk=module_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
issues = Issue.objects.filter(
|
||||||
|
pk__in=issues, workspace__slug=slug, project_id=project_id
|
||||||
|
)
|
||||||
|
|
||||||
ModuleIssue.objects.bulk_create(
|
ModuleIssue.objects.bulk_create(
|
||||||
[
|
[
|
||||||
ModuleIssue(
|
ModuleIssue(
|
||||||
|
Loading…
Reference in New Issue
Block a user