Add attachment management CRUD to the /uploads API

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.
This commit is contained in:
2026-07-26 16:46:41 +02:00
parent ac04cf6817
commit 5774d83ece
12 changed files with 592 additions and 13 deletions
+4
View File
@@ -115,6 +115,10 @@ from devplacepy.schemas.gateway import (
GatewayUsageOut,
UserAiUsageOut,
)
from devplacepy.schemas.uploads import (
UploadItemOut,
UploadsListOut,
)
from devplacepy.schemas.statistics import StatisticsOut
from devplacepy.schemas.auth import (
AuthPageOut,
+20
View File
@@ -0,0 +1,20 @@
# 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