Skip to main content

Class diagrams

Synced from slotting-optimization

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.

UML class diagrams of the domain model and of the hexagonal ports with the adapters that implement them. Go has no classes: a "class" here is a struct or a named type, an interface is marked <<interface>>, and only the members that matter for the model are shown.

Domain: slotplan and planning​

Source: internal/domain/slotplan/{plan,values,events}.go, internal/domain/planning/planner.go.

Ports and adapters​

Source: internal/application/ports/{ports,unit_of_work,clock}.go, internal/adapters/outbound/postgres/*.go, internal/adapters/outbound/kafka/encoder.go, internal/adapters/outbound/ids/ids.go, internal/adapters/outbound/clock/clock.go. Omits: the memory package, which implements every repository port with the same type names (memory.SlotPlanRepo, memory.DemandLedger, memory.ProfileDirectory, memory.SlotCatalogue, memory.OutboxRepo, memory.ProcessedEventRepo, memory.UnitOfWork) and is a test double only: no binary wires it (ADR 0011).

Inbound adapters and use cases​

Inbound adapterCalls
http.Server (chi router)GeneratePlan, ApprovePlan, RejectPlan, GetPlan, ListPlans, ListForwardSlots, ListSkuVelocity
kafka.Consumer "demand consumer"ApplyDemandChanged
kafka.Consumer "product consumer"ApplyProductClassified, ApplyPhysicalProfile
kafka.Consumer "layout consumer"ApplyZoneRegistered, ApplyLocationSlotRegistered, ApplyLocationSlotDecommissioned

The outbox relay (outbox.Relay) is driven by its own loop, not by a use case: it drains outbox.Store (postgres.OutboxRepo) into an outbox.Sink (kafka.RelaySink).