Files
toiminnanohjaus-django/apps/customers/application/queries.py
T
petriandClaude Opus 5.5 1ca03137fd Vaihe 1/4: asiakastyöt (numerointi, tagit, linkit, jäsenet, muutoshistoria)
- Uusi jobs-moduuli: asiakastyön kentät ilman rahakenttiä, juokseva
  vuosinumero VVVV-NNNN (laskuririvi lukitaan), tagit, linkit dialogissa,
  jäsenet ja muutoshistoria nimiarvoineen.
- Tilojen oikeudet: lasku luotu / laskutettu johto tai työn laskuttaja,
  arkistointi vain johto; alihankkija näkee vain jäsenyystyönsä eikä muokkaa.
- Lista ja haku (numero, nimi, asiakas), suodattimet, omat työt oletuksena,
  arkistoidut piilossa, myöhässä tekstinä ja kuvakkeena.
- Asiakasvalitsin hakuineen ja pikalisäyksineen (myös pikavastaanottoa varten).
- Asiakkaan sivulle asiakastyöt-osio; valikkoon Asiakastyöt.
- Lukurajapinnat muihin moduuleihin: UserQueries.choices,
  CustomerQueries.summaries, CatalogQueries.service_units; jobs.*-oikeudet.
- Import-linter-sopimukset, käännökset, testit (domain, application,
  integraatio, selain) sekä määrittelyn ja CLAUDE.md:n päivitys.

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

43 lines
1.4 KiB
Python

from collections.abc import Iterable, Sequence
from typing import Protocol
from apps.customers.application.dto import (
BillingUnitView,
ContactView,
CustomerDetails,
CustomerSummary,
)
from apps.customers.domain.enums import CustomerType
class CustomerQueries(Protocol):
"""Public read interface of the customers module."""
def list_customers(
self, *, search: str = "", type: CustomerType | None = None
) -> Sequence[CustomerSummary]:
"""Search by name or business ID (never by personal identity code); internal first."""
...
def search(self, term: str, *, limit: int = 20) -> Sequence[CustomerSummary]:
"""Autocomplete for other modules (e.g. job intake)."""
...
def get_summary(self, customer_id: int) -> CustomerSummary | None: ...
def summaries(self, customer_ids: Iterable[int]) -> dict[int, CustomerSummary]:
"""Many customers at once, keyed by id (for lists in other modules)."""
...
def get_details(
self, customer_id: int, *, include_full_personal_id: bool = False
) -> CustomerDetails | None: ...
def contacts(self, customer_id: int) -> Sequence[ContactView]: ...
def billing_units(self, customer_id: int) -> Sequence[BillingUnitView]: ...
def is_deletable(self, customer_id: int) -> bool:
"""Not internal and nothing (contacts, billing units, jobs, sales …) refers to it."""
...