Skip to content

Commit

Permalink
fix filesfolders api views (#1508)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Feb 14, 2025
1 parent 75667b9 commit c7d0d28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define USAGE=
@echo -e "\tmake collectstatic -- run collectstatic"
@echo -e "\tmake test [arg=<test_object>] -- run all tests or specify module/class/function"
@echo -e "\tmake manage_target arg=<target_command> -- run management command on target site, arg is mandatory"
@echo -e "\tmake spectacular -- generate API documentation with drf-spectacular"
@echo -e "\tmake spectacular -- test OpenAPI schema generation with drf-spectacular"
@echo -e
endef

Expand Down
6 changes: 5 additions & 1 deletion filesfolders/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# NB: Creating abstract serializers is not easily possible as explained in the
# following StackOverflow post: https://stackoverflow.com/a/33137535

import uuid

from typing import Optional

from rest_framework import serializers
from rest_framework.generics import get_object_or_404

Expand All @@ -16,7 +20,7 @@
class FilesfoldersSerializerMixin:
"""Shared code that does not need metaprogramming."""

def get_folder(self, obj):
def get_folder(self, obj: File) -> Optional[uuid.UUID]:
if obj.folder:
return obj.folder.sodar_uuid
else:
Expand Down
7 changes: 0 additions & 7 deletions filesfolders/views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
GenericAPIView,
)
from rest_framework.renderers import JSONRenderer
from rest_framework.schemas.openapi import AutoSchema
from rest_framework.versioning import AcceptHeaderVersioning

# Projectroles dependency
Expand Down Expand Up @@ -198,7 +197,6 @@ class FolderListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateFolder')
serializer_class = FolderSerializer


Expand Down Expand Up @@ -228,7 +226,6 @@ class FolderRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'folder'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyFolder')
serializer_class = FolderSerializer


Expand Down Expand Up @@ -268,7 +265,6 @@ class FileListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateFile')
serializer_class = FileSerializer


Expand Down Expand Up @@ -300,7 +296,6 @@ class FileRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'file'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyFile')
serializer_class = FileSerializer


Expand Down Expand Up @@ -358,7 +353,6 @@ class HyperLinkListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateHyperLink')
serializer_class = HyperLinkSerializer


Expand Down Expand Up @@ -389,5 +383,4 @@ class HyperLinkRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'hyperlink'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyHyperLink')
serializer_class = HyperLinkSerializer

0 comments on commit c7d0d28

Please sign in to comment.