40 lines
862 B
Python
40 lines
862 B
Python
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class UploadInitRequest(BaseModel):
|
|
sha256: str = Field(min_length=64, max_length=64)
|
|
file_name: str = Field(min_length=1, max_length=255)
|
|
file_size: int = Field(ge=0)
|
|
mime_type: str | None = Field(default=None, max_length=50)
|
|
resource_type: str = Field(default="image", max_length=20)
|
|
|
|
|
|
class UploadInitResponse(BaseModel):
|
|
upload_id: str
|
|
exists: bool
|
|
chunk_size: int
|
|
received_size: int
|
|
file_id: str | None = None
|
|
|
|
|
|
class UploadStatusResponse(BaseModel):
|
|
upload_id: str
|
|
sha256: str
|
|
file_name: str
|
|
file_size: int
|
|
received_size: int
|
|
status: str
|
|
|
|
|
|
class UploadCompleteRequest(BaseModel):
|
|
upload_id: str
|
|
|
|
|
|
class UploadCompleteResponse(BaseModel):
|
|
file_id: str
|
|
sha256: str
|
|
storage_path: str
|
|
file_size: int
|