@cubocicloide/stack-react-django 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- from drf_spectacular.utils import extend_schema
1
+ from drf_spectacular.utils import extend_schema, extend_schema_view
2
2
  from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin
3
3
  from rest_framework.parsers import MultiPartParser
4
4
  from rest_framework.permissions import AllowAny
@@ -8,7 +8,21 @@ from apps.files.models import FileUpload
8
8
  from apps.files.serializers import FileUploadSerializer
9
9
 
10
10
 
11
- @extend_schema(tags=["files"])
11
+ @extend_schema(tags=["Files"])
12
+ @extend_schema_view(
13
+ list=extend_schema(
14
+ summary="List uploaded files",
15
+ description=(
16
+ "Paginated, newest first. Each entry carries metadata plus a fresh "
17
+ "presigned `url` — the URLs expire, so read them from this endpoint "
18
+ "rather than caching them."
19
+ ),
20
+ ),
21
+ retrieve=extend_schema(
22
+ summary="Retrieve file metadata",
23
+ description="Returns the stored metadata and a newly signed download `url`.",
24
+ ),
25
+ )
12
26
  class FileUploadViewSet(CreateModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet):
13
27
  """Upload (multipart), list and retrieve stored files.
14
28
 
@@ -24,6 +38,15 @@ class FileUploadViewSet(CreateModelMixin, ListModelMixin, RetrieveModelMixin, Ge
24
38
  # explicit: every view must declare permission_classes (lint rule BE003).
25
39
  permission_classes = [AllowAny]
26
40
 
27
- @extend_schema(operation_id="files_create", description="Upload a file (multipart/form-data).")
41
+ @extend_schema(
42
+ operation_id="files_create",
43
+ summary="Upload a file",
44
+ description=(
45
+ "Send the binary as `multipart/form-data` on the `file` field. "
46
+ "`original_name`, `content_type` and `size` are derived server-side and "
47
+ "ignored if supplied. The response contains no binary — only metadata "
48
+ "and a presigned `url`."
49
+ ),
50
+ )
28
51
  def create(self, request, *args, **kwargs):
29
52
  return super().create(request, *args, **kwargs)