Vaihe 1/2: asiakkaat, yhteyshenkilöt ja laskutusyksiköt
- customers-moduuli Clean Architecture -kerroksin: asiakas (yritys/kuluttaja), Y-tunnuksen tarkiste ja yksilöllisyys, yhteyshenkilöt, laskutusyksiköt (verkkolaskuosoite vaatii välittäjätunnuksen) - henkilötunnus salattuna (Fernet) ja HMAC-tiiviste päällekkäisyyksiin; pääkäyttäjä ja johto näkevät ja poistavat, muut näkevät peitettynä - sisäinen asiakas data-migraatiolla, ei poistettavissa - yleinen poistonesto käänteisten relaatioiden perusteella (tulevat PROTECT-viiteavaimet estävät poiston automaattisesti) - asiakkaan sivu: lisäys ja muokkaus dialogissa HTMX:llä, fokuksen hallinta ja ruudunlukijailmoitukset; HTMX näyttää nyt 422-validointivirheet - testit: domain, application, integraatio ja selaintestit (axe); yhteiset fixturet apps/conftest.py:hin, FakeUnitOfWork shared-moduuliin - import-linter: moduulien riippumattomuussäännöt - dokumentit päivitetty Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from apps.customers.domain.enums import CustomerType
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CustomerDetailsData:
|
||||
"""Customer form input.
|
||||
|
||||
``personal_identity_code``: empty keeps the stored code, a value replaces it.
|
||||
``remove_personal_id``: remove the stored code (admin and management only).
|
||||
"""
|
||||
|
||||
name: str
|
||||
type: CustomerType
|
||||
business_id: str = ""
|
||||
personal_identity_code: str = ""
|
||||
remove_personal_id: bool = False
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class ContactData:
|
||||
name: str
|
||||
title: str = ""
|
||||
phone: str = ""
|
||||
email: str = ""
|
||||
note: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class BillingUnitData:
|
||||
name: str
|
||||
billing_address: str = ""
|
||||
e_invoice_address: str = ""
|
||||
e_invoice_operator: str = ""
|
||||
reference: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CustomerSummary:
|
||||
"""What other modules (jobs, sales) see of a customer."""
|
||||
|
||||
id: int
|
||||
name: str
|
||||
type: CustomerType
|
||||
business_id: str | None
|
||||
is_internal: bool
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class CustomerDetails:
|
||||
id: int
|
||||
name: str
|
||||
type: CustomerType
|
||||
business_id: str | None
|
||||
is_internal: bool
|
||||
personal_id_masked: str | None
|
||||
personal_id_full: str | None # only when explicitly requested by an authorized caller
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class ContactView:
|
||||
id: int
|
||||
customer_id: int
|
||||
name: str
|
||||
title: str
|
||||
phone: str
|
||||
email: str
|
||||
note: str
|
||||
in_use: bool
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class BillingUnitView:
|
||||
id: int
|
||||
customer_id: int
|
||||
name: str
|
||||
billing_address: str
|
||||
e_invoice_address: str
|
||||
e_invoice_operator: str
|
||||
reference: str
|
||||
in_use: bool
|
||||
Reference in New Issue
Block a user