semantics
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
# @SEMANTICS: storage, files, upload, download, backup, repository
|
||||
# @PURPOSE: API endpoints for file storage management (backups and repositories).
|
||||
# @LAYER: API
|
||||
# @RELATION: DEPENDS_ON -> [backend.src.models.storage]
|
||||
# @RELATION: DEPENDS_ON -> [StorageModels]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
#
|
||||
# @INVARIANT: All paths must be validated against path traversal.
|
||||
|
||||
@@ -31,8 +32,7 @@ router = APIRouter(tags=["storage"])
|
||||
# @PARAM: category (Optional[FileCategory]) - Filter by category.
|
||||
# @PARAM: path (Optional[str]) - Subpath within the category.
|
||||
# @RETURN: List[StoredFile] - List of files/directories.
|
||||
#
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.list_files]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
@router.get("/files", response_model=List[StoredFile])
|
||||
async def list_files(
|
||||
category: Optional[FileCategory] = None,
|
||||
@@ -63,7 +63,7 @@ async def list_files(
|
||||
#
|
||||
# @SIDE_EFFECT: Writes file to the filesystem.
|
||||
#
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.save_file]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
@router.post("/upload", response_model=StoredFile, status_code=201)
|
||||
async def upload_file(
|
||||
category: FileCategory = Form(...),
|
||||
@@ -95,7 +95,7 @@ async def upload_file(
|
||||
#
|
||||
# @SIDE_EFFECT: Deletes item from the filesystem.
|
||||
#
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.delete_file]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
@router.delete("/files/{category}/{path:path}", status_code=204)
|
||||
async def delete_file(
|
||||
category: FileCategory,
|
||||
@@ -126,7 +126,7 @@ async def delete_file(
|
||||
# @PARAM: path (str) - Relative path of the file.
|
||||
# @RETURN: FileResponse - The file content.
|
||||
#
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.get_file_path]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
@router.get("/download/{category}/{path:path}")
|
||||
async def download_file(
|
||||
category: FileCategory,
|
||||
@@ -158,8 +158,7 @@ async def download_file(
|
||||
# @PARAM: path (str) - Absolute or storage-root-relative file path.
|
||||
# @RETURN: FileResponse - The file content.
|
||||
#
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.get_storage_root]
|
||||
# @RELATION: CALLS -> [backend.src.plugins.storage.plugin.StoragePlugin.validate_path]
|
||||
# @RELATION: DEPENDS_ON -> [StoragePlugin]
|
||||
@router.get("/file")
|
||||
async def get_file_by_path(
|
||||
path: str,
|
||||
|
||||
Reference in New Issue
Block a user