file
This module defines a router for the api that is dedicated to file related responsibilities.
upload_file
async
upload_file(file: UploadFile, current_user: Annotated[models.User, Depends(oauth2.get_current_user)], minio_client: Annotated[files.Minio, Depends(files.get_minio_client)], celery_client: Annotated[celery.Celery, Depends(celery.get_celery_client)])
Endpoint for uploading files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
UploadFile
|
The file to be uploaded. |
required |
current_user |
User
|
The current authenticated user. |
required |
minio_client |
Minio
|
The MinIO client for interacting with the object storage. |
required |
celery_client |
Celery
|
The Celery client for queuing tasks. |
required |
Returns:
Type | Description |
---|---|
dict
|
A dictionary containing file metadata and status. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the file type is not supported or if there are errors during file upload or queuing. |
Source code in api/routers/file.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|