forked from github/plane
chore: add project details on importer service endpoint (#714)
* chore: add project details on importer service endpoint * dev: add select related for imports
This commit is contained in:
parent
5b72b1672f
commit
e46487c130
@ -1,11 +1,13 @@
|
|||||||
# Module imports
|
# Module imports
|
||||||
from .base import BaseSerializer
|
from .base import BaseSerializer
|
||||||
from .user import UserLiteSerializer
|
from .user import UserLiteSerializer
|
||||||
|
from .project import ProjectLiteSerializer
|
||||||
from plane.db.models import Importer
|
from plane.db.models import Importer
|
||||||
|
|
||||||
|
|
||||||
class ImporterSerializer(BaseSerializer):
|
class ImporterSerializer(BaseSerializer):
|
||||||
initiated_by_detail = UserLiteSerializer(source="initiated_by", read_only=True)
|
initiated_by_detail = UserLiteSerializer(source="initiated_by", read_only=True)
|
||||||
|
project_detail = ProjectLiteSerializer(source="project", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Importer
|
model = Importer
|
||||||
|
@ -213,8 +213,10 @@ class ImportServiceEndpoint(BaseAPIView):
|
|||||||
|
|
||||||
def get(self, request, slug):
|
def get(self, request, slug):
|
||||||
try:
|
try:
|
||||||
imports = Importer.objects.filter(workspace__slug=slug).order_by(
|
imports = (
|
||||||
"-created_at"
|
Importer.objects.filter(workspace__slug=slug)
|
||||||
|
.order_by("-created_at")
|
||||||
|
.select_related("initiated_by", "project", "workspace")
|
||||||
)
|
)
|
||||||
serializer = ImporterSerializer(imports, many=True)
|
serializer = ImporterSerializer(imports, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
Loading…
Reference in New Issue
Block a user