PakLog Aggregate Catalog

Complete Aggregate Documentation

Overview

This document provides a comprehensive catalog of all aggregates across the PakLog microservices ecosystem, including their relationships, invariants, and domain events.

Aggregate Relationship Map

graph TB
    subgraph "Order Domain"
        FO[FulfillmentOrder]
        OL[OrderLine]
        AR[AllocationResult]
    end

    subgraph "Inventory Domain"
        II[InventoryItem]
        IM[InventoryMovement]
        IA[InventoryAdjustment]
        LP[LicensePlate]
    end

    subgraph "Warehouse Execution"
        W[Wave]
        WT[WorkTask]
        PL[PickList]
        PS[PackingStation]
        PKG[Package]
    end

    subgraph "Robotics Domain"
        R[Robot]
        RM[RobotMission]
        FC[FleetCoordination]
    end

    subgraph "Returns Domain"
        RET[Return]
        RI[ReturnInspection]
        DD[DispositionDecision]
    end

    subgraph "Analytics Domain"
        F[Forecast]
        PM[PredictionModel]
        AJ[AnalyticsJob]
    end

    %% Relationships
    FO --> OL
    FO --> AR
    AR --> II
    W --> WT
    WT --> PL
    PL --> PKG
    R --> RM
    RET --> RI
    RI --> DD
    F --> PM

    classDef aggregate fill:#e3f2fd,stroke:#1976d2,stroke-width:3px
    class FO,II,W,WT,R,RET,F aggregate

Core Aggregates by Service

1. Order Management Service

FulfillmentOrder (Aggregate Root)

Purpose: Manages the complete lifecycle of customer orders

Attributes:

Invariants:

Domain Events:

State Transitions:

1
2
3
PENDING -> ALLOCATED -> RELEASED -> PICKING -> PACKING -> SHIPPED -> DELIVERED
     |                                                          |
     +-----------------------> CANCELLED <---------------------+

2. Inventory Service

InventoryItem (Aggregate Root)

Purpose: Tracks inventory levels and locations

Attributes:

Invariants:

Domain Events:


3. Cartonization Service

PackingSolution (Aggregate Root)

Purpose: Represents optimal packing arrangement for items

Attributes:

Invariants:

Domain Events:


4. Wave Planning Service

Wave (Aggregate Root)

Purpose: Groups orders for efficient batch processing

Attributes:

Invariants:

Domain Events:


5. Task Execution Service

WorkTask (Aggregate Root)

Purpose: Unified task model for all warehouse work

Attributes:

Invariants:

Domain Events:


6. Pick Execution Service

PickList (Aggregate Root)

Purpose: Manages picking operations with path optimization

Attributes:

Invariants:

Domain Events:


7. Pack & Ship Service

Package (Aggregate Root)

Purpose: Represents packed shipment ready for carrier

Attributes:

Invariants:

Domain Events:


8. Robotics Fleet Management

Robot (Aggregate Root)

Purpose: Individual robot management and coordination

Attributes:

Invariants:

Domain Events:

RobotMission (Entity)

Purpose: Represents assigned robot task

Attributes:


9. Returns Management

Return (Aggregate Root)

Purpose: Manages return merchandise authorization

Attributes:

Invariants:

Domain Events:


10. WES Orchestration Engine

WorkflowInstance (Aggregate Root)

Purpose: Orchestrates complex multi-service workflows

Attributes:

Invariants:

Domain Events:


11. Predictive Analytics Platform

Forecast (Aggregate Root)

Purpose: ML-based predictions for various metrics

Attributes:

Invariants:

Domain Events:


12. Yard Management System

YardLocation (Aggregate Root)

Purpose: Manages dock doors and yard positions

Attributes:

Invariants:

Domain Events:


13. Cross-Docking Operations

CrossDockOperation (Aggregate Root)

Purpose: Coordinates flow-through operations

Attributes:

Invariants:

Domain Events:


14. Last-Mile Delivery

DeliveryRoute (Aggregate Root)

Purpose: Optimized delivery routes using VRP

Attributes:

Invariants:

Domain Events:


15. Quality Compliance

InspectionRecord (Aggregate Root)

Purpose: Quality control and compliance tracking

Attributes:

Invariants:

Domain Events:

Value Objects Catalog

Common Value Objects

Address

Dimensions

Weight

Money

Coordinates

TimeWindow

SKU

LocationCode

Aggregate Design Principles

1. Consistency Boundaries

2. Aggregate Size

3. Identity

4. References

5. Domain Events

Event Sourcing Aggregates

Services Using Event Sourcing

  1. WES Orchestration Engine
    • Full event sourcing for workflow state
    • Event replay for debugging
    • Compensation tracking
  2. Order Management
    • Audit trail via events
    • State reconstruction capability
  3. Inventory
    • Movement history tracking
    • Point-in-time inventory queries
  4. Robotics Fleet
    • Mission replay capability
    • Performance analysis

Aggregate Anti-Patterns to Avoid

❌ Anemic Domain Model

❌ Large Aggregates

❌ Cross-Aggregate Transactions

❌ Bidirectional References

❌ Leaking Domain Logic