scheduleSon/backend/models.py
vrubel c40a6569b4
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 20s
Add event colors (Catppuccin Mocha) and read-only week view for users
Admins can now pick a color per event from a Catppuccin Mocha palette;
existing events default to blue. Colors flow through to both the admin
timeline and the new "Неделя" tab in the user view, which reuses the
admin's weekly grid in a read-only mode. Also reworks event blocks to
show a single-line "start–end title" so short events no longer overflow,
tidies the admin toolbar, and expands mobile responsiveness across both
frontends.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-12 18:03:21 +00:00

55 lines
1.5 KiB
Python

from pydantic import BaseModel
from typing import Optional, Literal
class TaskCreate(BaseModel):
date: str # YYYY-MM-DD
title: str
repeat_weekly: bool = False
copy_to_weekdays: Optional[list[int]] = None # список дней недели для копирования
class EventCreate(BaseModel):
date: str # YYYY-MM-DD
start_time: str # HH:MM
duration_min: int
title: str
repeat_weekly: bool = False
color: str = "blue" # ключ цвета из палитры Catppuccin Mocha
class TaskResponse(BaseModel):
id: int
date: str
title: str
kind: Literal["task"] = "task"
repeat_weekly: bool = False
class EventResponse(BaseModel):
id: int
date: str
start_time: str
duration_min: int
title: str
kind: Literal["event"] = "event"
repeat_weekly: bool = False
color: str = "blue"
class ScheduleItem(BaseModel):
kind: Literal["task", "event"]
id: int
date: str
source_date: Optional[str] = None
title: str
start_time: Optional[str] = None
duration_min: Optional[int] = None
repeat_weekly: Optional[bool] = None
color: Optional[str] = None
class ScheduleResponse(BaseModel):
items: list[ScheduleItem]
class UpdateRequest(BaseModel):
title: Optional[str] = None
date: Optional[str] = None
start_time: Optional[str] = None
duration_min: Optional[int] = None
occurrence_date: Optional[str] = None
scope: Optional[Literal["one_date", "series"]] = None # для weekly tasks
color: Optional[str] = None