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:
38
backend/app/schemas/project.py
Normal file
38
backend/app/schemas/project.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
Project Schemas
|
||||
"""
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class ProjectBase(BaseModel):
|
||||
"""Base project schema"""
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
description: Optional[str] = Field(None, max_length=2000)
|
||||
|
||||
|
||||
class ProjectCreate(ProjectBase):
|
||||
"""Project create schema"""
|
||||
pass
|
||||
|
||||
|
||||
class ProjectUpdate(BaseModel):
|
||||
"""Project update schema"""
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
description: Optional[str] = Field(None, max_length=2000)
|
||||
|
||||
|
||||
class ProjectResponse(ProjectBase):
|
||||
"""Project response schema"""
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
# Alias for CRUD
|
||||
ProjectCreateSchema = ProjectCreate
|
||||
ProjectUpdateSchema = ProjectUpdate
|
||||
Reference in New Issue
Block a user