260710_0
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
||||
|
||||
from config.config_system import UPLOAD_ALLOWED_EXT, UPLOAD_MAX_MB
|
||||
from config.config_system import UPLOAD_ALLOWED_EXT, UPLOAD_CHUNK_SIZE_BYTES, UPLOAD_MAX_MB
|
||||
|
||||
|
||||
class FileUploadDescriptor(BaseModel):
|
||||
@@ -50,3 +50,56 @@ class FileUploadResponse(BaseModel):
|
||||
status: str = "success"
|
||||
project_id: str
|
||||
files: list[UploadedFileResult]
|
||||
|
||||
|
||||
class ChunkSessionCreateRequest(FileUploadDescriptor):
|
||||
"""청크 업로드 세션 생성 요청."""
|
||||
|
||||
chunk_size_bytes: int = Field(default=UPLOAD_CHUNK_SIZE_BYTES, gt=0)
|
||||
|
||||
|
||||
class ChunkSessionCreateResponse(BaseModel):
|
||||
"""청크 업로드 세션 생성 응답."""
|
||||
|
||||
status: str = "success"
|
||||
project_id: str
|
||||
upload_session_id: str
|
||||
original_filename: str
|
||||
file_size_bytes: int
|
||||
chunk_size_bytes: int
|
||||
total_chunks: int
|
||||
completed_chunks: int = 0
|
||||
|
||||
|
||||
class ChunkUploadResponse(BaseModel):
|
||||
"""단일 청크 저장 응답."""
|
||||
|
||||
status: str = "success"
|
||||
upload_session_id: str
|
||||
chunk_index: int
|
||||
completed_chunks: int
|
||||
total_chunks: int
|
||||
chunk_hash: str
|
||||
|
||||
|
||||
class UploadFinalizeRequest(BaseModel):
|
||||
"""청크 업로드 완료 및 병합 요청."""
|
||||
|
||||
model_config = ConfigDict(extra="forbid", str_strip_whitespace=True)
|
||||
|
||||
session_id: str = Field(min_length=1, max_length=36)
|
||||
total_chunks: int = Field(gt=0)
|
||||
|
||||
|
||||
class UploadStatusResponse(BaseModel):
|
||||
"""청크 업로드 상태 조회 응답."""
|
||||
|
||||
status: str = "success"
|
||||
upload_session_id: str
|
||||
upload_status: str
|
||||
original_filename: str
|
||||
file_size_bytes: int
|
||||
chunk_size_bytes: int
|
||||
total_chunks: int
|
||||
completed_chunks: int
|
||||
completed_chunk_indexes: list[int]
|
||||
|
||||
Reference in New Issue
Block a user