chore: project create/update endpoint to be simillar to list (#2476)

* chore: project create endpoint to be simillar to list

* dev: make project create and update response same
This commit is contained in:
Nikhil 2023-10-27 15:35:15 +05:30 committed by GitHub
parent 4e86110123
commit 3e706f9653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,12 +273,9 @@ class ProjectViewSet(BaseViewSet):
]
)
data = serializer.data
# Additional fields of the member
data["sort_order"] = project_member.sort_order
data["member_role"] = project_member.role
data["is_member"] = True
return Response(data, status=status.HTTP_201_CREATED)
project = self.get_queryset().filter(pk=serializer.data["id"]).first()
serializer = ProjectListSerializer(project)
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(
serializer.errors,
status=status.HTTP_400_BAD_REQUEST,
@ -328,6 +325,8 @@ class ProjectViewSet(BaseViewSet):
color="#ff7700",
)
project = self.get_queryset().filter(pk=serializer.data["id"]).first()
serializer = ProjectListSerializer(project)
return Response(serializer.data, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)