mirror of
https://github.com/leaders-of-digital-9-task/backend.git
synced 2024-11-22 01:16:33 +03:00
bug fixes
This commit is contained in:
parent
dcac066a18
commit
13ab4ea2c2
|
@ -176,4 +176,4 @@ class ProjectSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Project
|
||||
fields = ["files", "created"]
|
||||
fields = ["files", "slug", "created"]
|
||||
|
|
|
@ -102,7 +102,7 @@ class SmartFileUploadApi(GenericAPIView):
|
|||
request.user,
|
||||
)
|
||||
return Response(
|
||||
ListDicomSerializer(project.files.all(), many=True).data,
|
||||
ProjectSerializer(project, context={"request": request}).data,
|
||||
status=status.HTTP_201_CREATED,
|
||||
)
|
||||
|
||||
|
@ -125,7 +125,7 @@ class AddDicomProjectApi(GenericAPIView):
|
|||
slug,
|
||||
)
|
||||
return Response(
|
||||
ListDicomSerializer(project.files.all(), many=True).data,
|
||||
ProjectSerializer(project, context={"request": request}).data,
|
||||
status=status.HTTP_201_CREATED,
|
||||
)
|
||||
|
||||
|
@ -134,17 +134,16 @@ class DeleteDicomProjectApi(GenericAPIView):
|
|||
serializer_class = SmartFileUploadSerializer
|
||||
|
||||
@extend_schema(
|
||||
operation_id="add_dicom_to_project",
|
||||
operation_id="delete_dicom_from_project",
|
||||
request=None,
|
||||
responses={200: ListDicomSerializer(many=True)},
|
||||
)
|
||||
def delete(self, request, slug, dicom_slug):
|
||||
project = get_object_or_404(Project, slug=slug)
|
||||
project.files.filter(slug=dicom_slug).delete()
|
||||
|
||||
return Response(
|
||||
ListDicomSerializer(
|
||||
project.files.all(), many=True, context={"request": request}
|
||||
).data,
|
||||
ProjectSerializer(project, context={"request": request}).data,
|
||||
status=status.HTTP_200_OK,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user