- 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]>
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
from collections.abc import Sequence
|
|
from typing import Protocol, Self
|
|
|
|
from apps.catalog.domain.entities import Service, ServiceUnit, WorkType
|
|
from apps.catalog.domain.value_objects import CatalogName
|
|
|
|
|
|
class CatalogItem(Protocol):
|
|
"""What service units, services and work types share: activation and ordering."""
|
|
|
|
@property
|
|
def id(self) -> int | None: ...
|
|
|
|
def with_active(self, active: bool) -> Self: ...
|
|
|
|
|
|
class OrderedRepository[T: CatalogItem](Protocol):
|
|
def get(self, item_id: int) -> T | None: ...
|
|
|
|
def save(self, item: T) -> T: ...
|
|
|
|
def sibling_ids(self, item: T) -> list[int]:
|
|
"""Ids of the rows on the same level as ``item`` (itself included), in order."""
|
|
...
|
|
|
|
def set_order(self, ids: Sequence[int]) -> None:
|
|
"""Renumber ``sort_order`` of these rows in the given order."""
|
|
...
|
|
|
|
|
|
class ServiceUnitRepository(OrderedRepository[ServiceUnit], Protocol):
|
|
def is_name_taken(self, name: CatalogName, *, exclude_id: int | None = None) -> bool: ...
|
|
|
|
def next_sort_order(self) -> int: ...
|
|
|
|
|
|
class ServiceRepository(OrderedRepository[Service], Protocol):
|
|
def is_name_taken(
|
|
self, service_unit_id: int, name: CatalogName, *, exclude_id: int | None = None
|
|
) -> bool: ...
|
|
|
|
def next_sort_order(self, service_unit_id: int) -> int: ...
|
|
|
|
|
|
class WorkTypeRepository(OrderedRepository[WorkType], Protocol):
|
|
def is_name_taken(
|
|
self,
|
|
service_unit_id: int,
|
|
service_id: int | None,
|
|
name: CatalogName,
|
|
*,
|
|
exclude_id: int | None = None,
|
|
) -> bool: ...
|
|
|
|
def next_sort_order(self, service_unit_id: int, service_id: int | None) -> int: ...
|