Add schemas for presigned URL requests and responses
Introduced two Pydantic models: `PresignedUrlRequest` and `PresignedUrlResponse`. These define the request and response structures for presigned URL generation, including fields for filenames, content types, and expiration details. This provides a clear contract for handling presigned URL functionality.
This commit is contained in:
24
backend/app/schemas/presigned_urls.py
Normal file
24
backend/app/schemas/presigned_urls.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PresignedUrlRequest(BaseModel):
|
||||||
|
"""Request model for generating presigned URLs."""
|
||||||
|
filename: str = Field(..., description="Original filename of the image")
|
||||||
|
content_type: str = Field(..., description="Content type of the file (e.g., image/jpeg)")
|
||||||
|
folder: str = Field("images", description="Folder to store the file in")
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"filename": "my-image.jpg",
|
||||||
|
"content_type": "image/jpeg",
|
||||||
|
"folder": "event-themes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class PresignedUrlResponse(BaseModel):
|
||||||
|
"""Response model for presigned URL generation."""
|
||||||
|
upload_url: str = Field(..., description="URL to upload the file to")
|
||||||
|
file_url: str = Field(..., description="URL where the file will be accessible after upload")
|
||||||
|
expires_in: int = Field(..., description="Time in seconds until the upload URL expires")
|
||||||
Reference in New Issue
Block a user