fix: changed the response structure (#6301)
This commit is contained in:
parent
61d6d928ba
commit
5e6c02358d
1 changed files with 13 additions and 1 deletions
|
|
@ -572,6 +572,7 @@ class PageDuplicateEndpoint(BaseAPIView):
|
||||||
page.pk = None
|
page.pk = None
|
||||||
page.name = f"{page.name} (Copy)"
|
page.name = f"{page.name} (Copy)"
|
||||||
page.description_binary = None
|
page.description_binary = None
|
||||||
|
page.owned_by = request.user
|
||||||
page.save()
|
page.save()
|
||||||
|
|
||||||
for project_id in project_ids:
|
for project_id in project_ids:
|
||||||
|
|
@ -586,6 +587,17 @@ class PageDuplicateEndpoint(BaseAPIView):
|
||||||
page_transaction.delay(
|
page_transaction.delay(
|
||||||
{"description_html": page.description_html}, None, page.id
|
{"description_html": page.description_html}, None, page.id
|
||||||
)
|
)
|
||||||
page = Page.objects.get(pk=page.id)
|
page = (
|
||||||
|
Page.objects.filter(pk=page.id)
|
||||||
|
.annotate(
|
||||||
|
project_ids=Coalesce(
|
||||||
|
ArrayAgg(
|
||||||
|
"projects__id", distinct=True, filter=~Q(projects__id=True)
|
||||||
|
),
|
||||||
|
Value([], output_field=ArrayField(UUIDField())),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.first()
|
||||||
|
)
|
||||||
serializer = PageDetailSerializer(page)
|
serializer = PageDetailSerializer(page)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue