Files
LogHive/backend/app/schemas/project.py
T
2026-05-09 14:55:14 +08:00

35 lines
806 B
Python

"""Project schemas."""
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class ProjectCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=128, description="Project name")
description: str = Field(default="", max_length=1024)
class ProjectUpdate(BaseModel):
name: Optional[str] = Field(default=None, max_length=128)
description: Optional[str] = Field(default=None, max_length=1024)
is_active: Optional[bool] = None
class ProjectResponse(BaseModel):
id: str
name: str
description: str
is_active: bool
created_at: datetime
updated_at: datetime
model_config = {"from_attributes": True}
class ProjectWithToken(ProjectResponse):
api_key: str
model_config = {"from_attributes": True}