chore: response changes of get and post

This commit is contained in:
NarayanBavisetti 2024-05-27 12:28:23 +05:30
parent 5fe135d1ac
commit 2e341c3f01
2 changed files with 3 additions and 15 deletions

View File

@ -48,10 +48,6 @@ class EstimatePointSerializer(BaseSerializer):
class EstimateReadSerializer(BaseSerializer): class EstimateReadSerializer(BaseSerializer):
points = EstimatePointSerializer(read_only=True, many=True) points = EstimatePointSerializer(read_only=True, many=True)
workspace_detail = WorkspaceLiteSerializer(
read_only=True, source="workspace"
)
project_detail = ProjectLiteSerializer(read_only=True, source="project")
class Meta: class Meta:
model = Estimate model = Estimate

View File

@ -95,16 +95,8 @@ class BulkEstimatePointEndpoint(BaseViewSet):
ignore_conflicts=True, ignore_conflicts=True,
) )
estimate_point_serializer = EstimatePointSerializer( serializer = EstimateReadSerializer(estimate)
estimate_points, many=True return Response(serializer.data, status=status.HTTP_200_OK)
)
return Response(
{
"estimate_points": estimate_point_serializer.data,
},
status=status.HTTP_200_OK,
)
def retrieve(self, request, slug, project_id, estimate_id): def retrieve(self, request, slug, project_id, estimate_id):
estimate = Estimate.objects.get( estimate = Estimate.objects.get(
@ -166,7 +158,7 @@ class BulkEstimatePointEndpoint(BaseViewSet):
) )
return Response( return Response(
{ {
"estimate_points": estimate_point_serializer.data, "points": estimate_point_serializer.data,
}, },
status=status.HTTP_200_OK, status=status.HTTP_200_OK,
) )