Complete the read and update faces of the signed-in user's attachment
management over the existing attachments table:
- GET /uploads: paginated list of the user's own attachments, newest
first, with an optional linked/orphaned filter
- GET /uploads/{uid}: fetch one attachment (owner or admin)
- PATCH /uploads/{uid}: rename the display filename, always preserving
the original extension (owner or admin, audited as attachment.rename)
Adds get_user_attachments/get_user_attachment data helpers, the
rename_attachment operation, AttachmentRenameForm, the UploadItemOut and
UploadsListOut schemas, the Devii tools list_attachments/get_attachment/
rename_attachment, expanded API reference documentation for the full
lifecycle including delete, and api-tier tests.
21 lines
446 B
Python
21 lines
446 B
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Optional
|
|
|
|
from devplacepy.schemas.base import _Out
|
|
from devplacepy.schemas.profile import MediaItemOut
|
|
|
|
|
|
class UploadItemOut(MediaItemOut):
|
|
is_audio: bool = False
|
|
linked: bool = False
|
|
user_uid: Optional[str] = None
|
|
|
|
|
|
class UploadsListOut(_Out):
|
|
attachments: list[UploadItemOut] = []
|
|
pagination: Optional[Any] = None
|
|
total: int = 0
|