feat(backend): 添加 API Schemas 定义
- 添加 Chunk 数据结构 (chunk.py) - 添加 Dataset Schema (dataset.py) - 添加 Evaluation Schema (eval.py) - 添加 File Schema (file.py) - 添加 Project Schema (project.py) - 添加 Question Schema (question.py) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
43
backend/app/schemas/file.py
Normal file
43
backend/app/schemas/file.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""
|
||||
File Schemas
|
||||
"""
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FileBase(BaseModel):
|
||||
"""Base file schema"""
|
||||
filename: str = Field(..., min_length=1, max_length=255)
|
||||
file_type: str = Field(..., max_length=50)
|
||||
size: Optional[int] = None
|
||||
|
||||
|
||||
class FileCreate(FileBase):
|
||||
"""File create schema"""
|
||||
project_id: UUID
|
||||
file_path: Optional[str] = None
|
||||
status: str = "pending"
|
||||
|
||||
|
||||
class FileUpdate(BaseModel):
|
||||
"""File update schema"""
|
||||
status: Optional[str] = None
|
||||
|
||||
|
||||
class FileResponse(FileBase):
|
||||
"""File response schema"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
project_id: UUID
|
||||
file_path: Optional[str]
|
||||
status: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
# Alias for CRUD
|
||||
FileCreateSchema = FileCreate
|
||||
FileUpdateSchema = FileUpdate
|
||||
Reference in New Issue
Block a user