Kairo-Jinkendo/backend/schemas/schedule_payload.py
Lars ea0aa18b8d
All checks were successful
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 4m57s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s
feat(schedule): einheitliche Rhythmus-Schicht an Gate und Arbeitspaket
Bestehende Recurring-Pfade bleiben kompatibel (interval_days-Fallback, Migration backfillt schedules), damit der aktuelle Betrieb nicht bricht und der Stand auf einem zweiten Rechner weitergebaut werden kann.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-14 09:23:00 +02:00

26 lines
866 B
Python

"""Shared Pydantic models for Schedule API payloads."""
from __future__ import annotations
from typing import Literal, Optional
from pydantic import BaseModel, Field, model_validator
class SchedulePayload(BaseModel):
schedule_kind: Literal["interval", "weekdays"] = "interval"
interval_days: int = Field(default=1, gt=0)
weekday_mask: int = Field(default=0, ge=0, le=127)
pause_until: Optional[str] = Field(default=None, description="ISO date YYYY-MM-DD")
@model_validator(mode="after")
def validate_kind(self) -> "SchedulePayload":
if self.schedule_kind == "weekdays" and self.weekday_mask <= 0:
raise ValueError("Mindestens ein Wochentag auswählen")
return self
def pause_until_date(self):
from services.schedule import _parse_pause_until
return _parse_pause_until(self.pause_until)