- 新增 CrawlerView 爬虫页面 - 完善 HomeView 分页展示(9个/页) - 更新 ProjectCard 组件图标 - 优化 API 客户端和类型定义 - 重构样式文件结构到独立目录 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
984 B
Python
41 lines
984 B
Python
"""
|
|
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)
|
|
type: str = Field(default="qa") # qa, table, database
|
|
|
|
|
|
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)
|
|
type: Optional[str] = Field(None)
|
|
|
|
|
|
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
|