Projekte pro Benutzer mit Name und Farbe, Clips optional einem Projekt zugeordnet. Löschen eines Projekts verschiebt seine Clips nach "ohne Projekt". Clip-Liste filtert nach Projekt und sucht Teiltexte in Titel und Inhalt, unabhängig von Groß-/Kleinschreibung (auch Umlaute). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
652 B
Python
30 lines
652 B
Python
from datetime import datetime
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from app.models import PROJECT_COLORS
|
|
|
|
ProjectColor = Literal[PROJECT_COLORS] # type: ignore[valid-type]
|
|
|
|
|
|
class ProjectCreate(BaseModel):
|
|
name: str = Field(max_length=1000)
|
|
color: ProjectColor = "blue"
|
|
|
|
|
|
class ProjectUpdate(BaseModel):
|
|
name: str | None = Field(default=None, max_length=1000)
|
|
color: ProjectColor | None = None
|
|
|
|
|
|
class ProjectOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
name: str
|
|
color: str
|
|
clip_count: int = 0
|
|
created_at: datetime
|
|
updated_at: datetime
|