Skip to main content

Class diagrams

Synced from inbound-receiving

This page is a copy of docs/docs/ddd/class-diagram.md on develop, derived from that repository's code. Edit it there, then re-sync.

DockAppointment moved (ADR 0019)

The dock appointment is owned by dock-scheduling since ADR 0019. This context keeps a read-only local copy fed by dock-scheduling's DockAppointmentBooked / DockAppointmentCancelled, no longer books, checks in, cancels or completes appointments, and no longer raises the four DockAppointment* events (the one-shot api republish-appointments backfill that re-announced them was removed, ADR 0022). Where this page describes those commands, rules or events, read it as the pre-transfer design; the page is not yet rewritten.

UML class diagrams of the domain model and of the hexagonal ports with their adapters. Type and method names are the real ones; unexported fields are shown only where they carry an invariant. The domain is split in two diagrams to keep each readable.

Asn and DockAppointment​

Source: internal/domain/asn/{asn,events}.go, internal/domain/appointment/appointment.go (its events.go, Schedule, Book and the lifecycle methods are gone, ADR 0019 and ADR 0022), internal/domain/shared/*.go. Omits: getters, Header, the Event interfaces and the sentinel errors. DockAppointment holds ASN numbers (by id), not Asn objects.

Receipt​

Source: internal/domain/receipt/{receipt,events}.go. Omits: getters, Header, LineState and Persisted (the persisted shapes used by Rehydrate). The appointmentID and doorCode references are by id and empty for a walk-in.

Ports and adapters​

Source: internal/application/ports/*.go, cmd/api/main.go (adapters, buildAdapters, buildServer), the adapter packages under internal/adapters. Omits: Clock and IDGenerator (trivial clock.System, idgen.UUID), the in-memory implementations of every other port (the Memory adapter is a test double only: no cmd/** file imports it, ADR 0011, and it implements the same ports as Postgres; only two edges are drawn), the Kafka relay sink, telemetry and the Postgres pool. FanoutEncoder wraps the integration Encoder and the AnalyticsEncoder, so every event yields two outbox rows under one CloudEvents id (ADR 0006). Also omitted: the read-only MCP adapter (internal/adapters/inbound/mcp, wired by cmd/mcp to the same read use cases as HttpServer) and the analytics read side (internal/adapters/outbound/analyticsstore, the projector's AnalyticsConsumer and the reports router over the report.Reader port), which never touch these ports' write side. Adapters never import each other: only the cmd/* composition roots wire them to the use cases.