52ff2f80ad
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Lint (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Build Production Runtime Images (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
Deploy / Production Browser E2E (push) Has been cancelled
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
"""Title library Pydantic schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TitleLibraryItemResponse(BaseModel):
|
|
id: str
|
|
user_id: str
|
|
name: str
|
|
text: str
|
|
category: str = "default"
|
|
description: str = ""
|
|
tags: List[str] = Field(default_factory=list)
|
|
usage_count: int = 0
|
|
is_active: bool = True
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class ListTitleLibraryResponse(BaseModel):
|
|
items: list[TitleLibraryItemResponse]
|
|
total: int = 0
|
|
|
|
|
|
class CreateTitleLibraryRequest(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
text: str = Field(..., min_length=1, max_length=500)
|
|
category: str = "default"
|
|
description: str = ""
|
|
tags: List[str] = Field(default_factory=list)
|
|
|
|
|
|
class UpdateTitleLibraryRequest(BaseModel):
|
|
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
|
text: Optional[str] = Field(None, min_length=1, max_length=500)
|
|
category: Optional[str] = None
|
|
description: Optional[str] = None
|
|
tags: Optional[List[str]] = None
|