Files
petriandClaude Opus 5.5 679bf57eb4 Vaihe 1/3: pohjatiedot (palveluyksiköt, palvelut ja työtehtävät)
- Uusi catalog-moduuli: palveluyksikkö → (palvelu) → työtehtävä ilman hintoja.
- Pohjatiedot-sivu /catalog/ pääkäyttäjälle ja johdolle (oikeus catalog.manage):
  lisäys ja muokkaus dialogissa, Siirrä ylös / Siirrä alas, käytöstä poisto ja
  käyttöön otto. Fokus ja aria-live-ilmoitus jokaisen muutoksen jälkeen.
- Rivejä ei poisteta. Käytöstä poistetun yläkohdan alla olevat rivit säilyttävät
  oman tilansa, mutta eivät ole valittavissa. Nimi on yksilöllinen samalla
  tasolla kirjainkoosta riippumatta.
- Työtehtävän voi siirtää saman yksikön toiseen palveluun tai suoraan yksikön alle.
- Luvun 11.1 lista data-migraationa (0002_seed), jos taulut ovat tyhjiä.
- CatalogQueries: work_type_options, active_service_units ja get_work_type
  tehtäviä ja tuntikirjausta varten.
- Import-linter-sopimukset, suomennokset, yksikkö-, integraatio- ja selaintestit.
- Päivitetty CLAUDE.md ja määrittelyn kohta 16.3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 14:07:41 +02:00

81 lines
1.8 KiB
Python

from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class ServiceUnitData:
name: str
@dataclass(frozen=True, slots=True)
class ServiceData:
name: str
@dataclass(frozen=True, slots=True)
class WorkTypeData:
"""``service_id`` None places the work type directly under its service unit."""
name: str
service_id: int | None = None
# --- Read models ---------------------------------------------------------------------------------
@dataclass(frozen=True, slots=True)
class WorkTypeNode:
id: int
service_unit_id: int
service_id: int | None
name: str
is_active: bool
is_selectable: bool # active and every parent active
@dataclass(frozen=True, slots=True)
class ServiceNode:
id: int
service_unit_id: int
name: str
is_active: bool
work_types: tuple[WorkTypeNode, ...]
@dataclass(frozen=True, slots=True)
class ServiceUnitNode:
"""One service unit of the base data tree, inactive rows included."""
id: int
name: str
is_shared: bool
is_active: bool
services: tuple[ServiceNode, ...]
work_types: tuple[WorkTypeNode, ...] # directly under the unit
@dataclass(frozen=True, slots=True)
class ServiceUnitSummary:
"""What other modules (jobs) see of a service unit."""
id: int
name: str
is_shared: bool
@dataclass(frozen=True, slots=True)
class WorkTypeOption:
"""A work type as other modules (tasks, time tracking) list and show it."""
id: int
name: str
service_unit_id: int
service_unit_name: str
service_name: str | None
is_selectable: bool
@property
def label(self) -> str:
"""E.g. "Mediatuotanto / Videotuotanto / Editointi"."""
parts = [self.service_unit_name, self.service_name, self.name]
return " / ".join(p for p in parts if p)