2026-03-17 17:28:47 +08:00
|
|
|
"""
|
|
|
|
|
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)
|
2026-03-18 10:45:32 +08:00
|
|
|
type: str = Field(default="qa") # qa, table, database
|
2026-03-17 17:28:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
2026-03-18 10:45:32 +08:00
|
|
|
type: Optional[str] = Field(None)
|
2026-03-17 17:28:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|