feat: v4.0 - multi-day horizontal canvas, duration input, overnight blocks, PDF horizontal layout
Some checks failed
Build & Push Docker / build (push) Has been cancelled

This commit is contained in:
2026-02-20 17:31:41 +01:00
parent e3a5330cc2
commit 47add509ca
11 changed files with 1188 additions and 773 deletions

View File

@@ -1,6 +1,7 @@
"""Pydantic v2 models for Scenar Creator v3."""
"""Pydantic v2 models for Scenar Creator v4."""
import uuid
from datetime import date as date_type, timedelta
from typing import List, Optional
from pydantic import BaseModel, Field
@@ -8,9 +9,9 @@ from pydantic import BaseModel, Field
class Block(BaseModel):
id: str = Field(default_factory=lambda: str(uuid.uuid4()))
date: str # "YYYY-MM-DD"
start: str # "HH:MM"
end: str # "HH:MM"
date: str # "YYYY-MM-DD"
start: str # "HH:MM" (can be > 24:00 for overnight continuation)
end: str # "HH:MM" (if end < start → overnight block)
title: str
type_id: str
responsible: Optional[str] = None
@@ -20,13 +21,16 @@ class Block(BaseModel):
class ProgramType(BaseModel):
id: str
name: str
color: str # "#RRGGBB"
color: str # "#RRGGBB"
class EventInfo(BaseModel):
title: str
subtitle: Optional[str] = None
date: Optional[str] = None
# Multi-day: date_from → date_to (inclusive). Backward compat: date = date_from.
date: Optional[str] = None # legacy / backward compat
date_from: Optional[str] = None
date_to: Optional[str] = None
location: Optional[str] = None
@@ -35,3 +39,8 @@ class ScenarioDocument(BaseModel):
event: EventInfo
program_types: List[ProgramType]
blocks: List[Block]
def get_sorted_dates(self) -> List[str]:
"""Return sorted list of unique block dates."""
dates = sorted(set(b.date for b in self.blocks))
return dates