Skip to content

Chemistry: add Stock Solution Batch API (create, track volume, expire/dispose) #177

Description

@joshholl

Epic: #171

User Story

As a home developer, I want to record the bulk batches I mix so that I can track how much I have left and when they expire.

Acceptance Criteria

  • New chemical_batches table: id, chemical_product_id (FK), label, total_volume_ml, remaining_volume_ml, concentration, mixed_date, expiry_date (nullable override), status (ACTIVE/EXHAUSTED/DISPOSED), notes
  • expiry_date defaults to mixed_date + product.default_shelf_life_days if not overridden; null if product has no shelf life (e.g. Water)
  • POST /api/chemistry/batches — create batch
  • GET /api/chemistry/batches — list (optional ?status= filter)
  • PUT /api/chemistry/batches/:id — update
  • POST /api/chemistry/batches/:id/draw — decrement remaining_volume_ml by specified amount (called when a working solution is created from this batch)
  • PATCH /api/chemistry/batches/:id/status — mark EXHAUSTED or DISPOSED
  • Volume draw blocked if remainingVolumeMl < requested amount
  • Unit tests for ChemicalBatchService

Notes

  • Water batch: volume and expiry are unbounded (remaining_volume_ml can be null for system chemicals)

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-apicomponent-chemistryPart of the chemistry component that will be used to manage chemistry stocks for developing filmsenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions