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,98 @@
|
||||
from apps.shared.domain.exceptions import DomainError
|
||||
|
||||
|
||||
class InvalidCustomerName(DomainError):
|
||||
code = "invalid_customer_name"
|
||||
field = "name"
|
||||
|
||||
|
||||
class InvalidBusinessId(DomainError):
|
||||
code = "invalid_business_id"
|
||||
field = "business_id"
|
||||
|
||||
|
||||
class InvalidPersonalIdentityCode(DomainError):
|
||||
code = "invalid_personal_id"
|
||||
field = "personal_identity_code"
|
||||
|
||||
|
||||
class ConsumerCannotHaveBusinessId(DomainError):
|
||||
code = "consumer_cannot_have_business_id"
|
||||
field = "business_id"
|
||||
|
||||
|
||||
class CompanyCannotHavePersonalId(DomainError):
|
||||
code = "company_cannot_have_personal_id"
|
||||
field = "personal_identity_code"
|
||||
|
||||
|
||||
class InternalCustomerMustBeCompany(DomainError):
|
||||
code = "internal_customer_must_be_company"
|
||||
field = "type"
|
||||
|
||||
|
||||
class BusinessIdTaken(DomainError):
|
||||
code = "business_id_taken"
|
||||
field = "business_id"
|
||||
|
||||
|
||||
class PersonalIdTaken(DomainError):
|
||||
code = "personal_id_taken"
|
||||
field = "personal_identity_code"
|
||||
|
||||
|
||||
class PersonalIdRemovalNotAllowed(DomainError):
|
||||
"""Only admin and management may remove a personal identity code."""
|
||||
|
||||
code = "personal_id_removal_not_allowed"
|
||||
field = "remove_personal_id"
|
||||
|
||||
|
||||
class CustomerNotFound(DomainError):
|
||||
code = "customer_not_found"
|
||||
|
||||
|
||||
class CustomerInUse(DomainError):
|
||||
"""Something (contacts, billing units, jobs, sales, invoices) still refers to the customer."""
|
||||
|
||||
code = "customer_in_use"
|
||||
|
||||
|
||||
class InternalCustomerCannotBeDeleted(DomainError):
|
||||
code = "internal_customer_cannot_be_deleted"
|
||||
|
||||
|
||||
class InvalidContactName(DomainError):
|
||||
code = "invalid_contact_name"
|
||||
field = "name"
|
||||
|
||||
|
||||
class InvalidBillingUnitName(DomainError):
|
||||
code = "invalid_billing_unit_name"
|
||||
field = "name"
|
||||
|
||||
|
||||
class InvalidEInvoiceAddress(DomainError):
|
||||
code = "invalid_e_invoice_address"
|
||||
field = "e_invoice_address"
|
||||
|
||||
|
||||
class EInvoiceOperatorRequired(DomainError):
|
||||
code = "e_invoice_operator_required"
|
||||
field = "e_invoice_operator"
|
||||
|
||||
|
||||
class ContactNotFound(DomainError):
|
||||
code = "contact_not_found"
|
||||
|
||||
|
||||
class BillingUnitNotFound(DomainError):
|
||||
code = "billing_unit_not_found"
|
||||
|
||||
|
||||
class ContactInUse(DomainError):
|
||||
code = "contact_in_use"
|
||||
|
||||
|
||||
class BillingUnitInUse(DomainError):
|
||||
code = "billing_unit_in_use"
|
||||
Reference in New Issue
Block a user