Skip to content

Routes

interfaces.upload.routes

Summary

Upload REST handlers — thin API entry points for the upload resource, wired to openapi.yaml operationIds by the OpenAPI-first router. Files are persisted under UPLOAD_DIR and a name-hashed copy is registered with the upload service.

Classes

Functions

get_uploaded_file async

get_uploaded_file(request: Request, filepath: str)

Serve an uploaded file from disk.

Parameters:

Name Type Description Default
request Request

Incoming HTTP request.

required
filepath str

Relative path of the file under UPLOAD_DIR.

required

Returns:

Name Type Description
FileResponse

The requested file with its original filename.

Raises:

Type Description
HTTPException

404 when the file does not exist.

list_uploads async

list_uploads(request: Request)

List all upload records.

Parameters:

Name Type Description Default
request Request

Incoming HTTP request; carries app.state.db_resources.

required

Returns:

Type Description

list[UploadDocument]: All uploads from the upload service.

upload_file async

upload_file(request: Request)

Upload a raw request body as a file.

The filename is parsed from the content-disposition header (defaulting to upload) and combined with a content hash to form the stored filename under UPLOAD_DIR. The resulting UploadResult is persisted via the upload service.

Parameters:

Name Type Description Default
request Request

Incoming HTTP request; carries the body, content type, and app.state.db_resources.

required

Returns:

Name Type Description
UploadDocument

The created upload record.