forked from github/plane
fix: return issue detailing in module list response
This commit is contained in:
parent
2397559a0e
commit
49fc8caf5a
@ -22,6 +22,8 @@ from plane.db.models import (
|
|||||||
IssueBlocker,
|
IssueBlocker,
|
||||||
CycleIssue,
|
CycleIssue,
|
||||||
Cycle,
|
Cycle,
|
||||||
|
Module,
|
||||||
|
ModuleIssue,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -342,6 +344,37 @@ class IssueCycleDetailSerializer(BaseSerializer):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class ModuleBaseSerializer(BaseSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Module
|
||||||
|
fields = "__all__"
|
||||||
|
read_only_fields = [
|
||||||
|
"workspace",
|
||||||
|
"project",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class IssueModuleDetailSerializer(BaseSerializer):
|
||||||
|
|
||||||
|
module_detail = ModuleBaseSerializer(read_only=True, source="module")
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ModuleIssue
|
||||||
|
fields = "__all__"
|
||||||
|
read_only_fields = [
|
||||||
|
"workspace",
|
||||||
|
"project",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class IssueSerializer(BaseSerializer):
|
class IssueSerializer(BaseSerializer):
|
||||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||||
state_detail = StateSerializer(read_only=True, source="state")
|
state_detail = StateSerializer(read_only=True, source="state")
|
||||||
@ -351,6 +384,7 @@ class IssueSerializer(BaseSerializer):
|
|||||||
blocked_issues = BlockedIssueSerializer(read_only=True, many=True)
|
blocked_issues = BlockedIssueSerializer(read_only=True, many=True)
|
||||||
blocker_issues = BlockerIssueSerializer(read_only=True, many=True)
|
blocker_issues = BlockerIssueSerializer(read_only=True, many=True)
|
||||||
issue_cycle = IssueCycleDetailSerializer(read_only=True)
|
issue_cycle = IssueCycleDetailSerializer(read_only=True)
|
||||||
|
issue_module = IssueModuleDetailSerializer(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Issue
|
model = Issue
|
||||||
|
@ -44,7 +44,7 @@ class ModuleViewSet(BaseViewSet):
|
|||||||
.prefetch_related("members")
|
.prefetch_related("members")
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
Prefetch(
|
Prefetch(
|
||||||
"module_issues",
|
"issue_module",
|
||||||
queryset=ModuleIssue.objects.select_related("module", "issue"),
|
queryset=ModuleIssue.objects.select_related("module", "issue"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
24
apiserver/plane/db/migrations/0014_auto_20221222_1436.py
Normal file
24
apiserver/plane/db/migrations/0014_auto_20221222_1436.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 3.2.14 on 2022-12-22 09:06
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('db', '0013_projectmember_default_props'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='moduleissue',
|
||||||
|
name='issue',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issue_module', to='db.issue'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='moduleissue',
|
||||||
|
name='module',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issue_module', to='db.module'),
|
||||||
|
),
|
||||||
|
]
|
@ -71,10 +71,10 @@ class ModuleMember(ProjectBaseModel):
|
|||||||
class ModuleIssue(ProjectBaseModel):
|
class ModuleIssue(ProjectBaseModel):
|
||||||
|
|
||||||
module = models.ForeignKey(
|
module = models.ForeignKey(
|
||||||
"db.Module", on_delete=models.CASCADE, related_name="module_issues"
|
"db.Module", on_delete=models.CASCADE, related_name="issue_module"
|
||||||
)
|
)
|
||||||
issue = models.ForeignKey(
|
issue = models.ForeignKey(
|
||||||
"db.Issue", on_delete=models.CASCADE, related_name="module_issues"
|
"db.Issue", on_delete=models.CASCADE, related_name="issue_module"
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
Loading…
Reference in New Issue
Block a user