Build a small warehouse GraphQL API with 6 warehouse-domain tables:
- Organization
- Supplier
- StorageArea
- Product
- StockMovement
- MovementLine
Add one supporting identity table outside the warehouse domain:
- User
User exists for authentication and organization membership. It is not a
warehouse concept.
Minimum useful features:
- Create organization
- Create supplier
- Create storage area
- Create product
- Create stock movement with lines
- Read stock movements by storage area
- Read products by supplier
- Read products by organization
- Read one stock movement with its lines and products
A stock movement must have at least one movement line, and every movement line must have a positive quantity and a non-negative unit cost.
Use only products that belong to the same organization as the storage area.
Prices and costs must be represented with a Money value object, not floating point numbers. Store money in the domain as integer cents, and map it carefully at the database and GraphQL boundaries.
lineTotal is computed from quantity * unitCost in the domain model. Do not
store it as a movement line column at first.
Each product belongs to exactly one supplier in this project. A real inventory
system may later introduce a ProductSupplier join table so the same product
can be purchased from multiple suppliers.
The Ulid suffix is only used here to make identity fields explicit in the
domain sketch. The implementation can still use simpler names such as id,
organizationId, or productId.
- userUlid
- organizationUlid
- passwordHash
- organizationUlid
- name
- supplierUlid
- organizationUlid
- name
- productUlid
- organizationUlid
- supplierUlid
- sku
- label
- unit
- purchasePrice
- isActive
- storageAreaUlid
- organizationUlid
- code
- label
- stockMovementUlid
- storageAreaUlid
- movementDate
- reference
- description
- movementLineUlid
- stockMovementUlid
- productUlid
- quantity
- direction
- unitCost
- description
StorageArea
│
└──────< StockMovement
│
└──────< MovementLine >────── Product
- Money / Montant
- Product / Produit
- Supplier / Fournisseur
- Storage area / Zone de stockage
- Stock movement / Mouvement de stock
- Movement line / Ligne de mouvement