fix(medications): release-QA findings on the inventory overhaul

- The legacy GLP-1 ledger reads again: GET and the Coach snapshot fall
  back to ledger-derived pen/dose figures when a medication has no
  inventory items; items always win once they exist. The delta branch
  on the POST is marked deprecated in favour of the inventory endpoints.
- Expired containers count as available nowhere: one shared supply
  summary (ACTIVE/IN_USE with units) feeds the overview row, the
  Bestand summary, the list payload, the GLP-1 card, and the runway
  estimate; expired units surface as a muted suffix instead.
- The inventory endpoints speak one wire dialect: request fields renamed
  to unitsTotal/unitsRemaining to match the responses, OpenAPI regenerated.
- The reorder dialog mirrors the page's grouping: active and inactive
  sections, each sortable within itself, so a saved order can never
  interleave them.
- Polish strings avoid the 2-4 plural trap, sub-dose quantities render
  as below one dose instead of approximately zero, and the table's name
  sort collates by the active locale instead of hardcoded German.
This commit is contained in:
Marc-André Bombeck committed 2026-06-12 19:11:53 +02:00
1 parent b765febc97
commit 9dc0ccd03a
28 files changed
+1017 -180

No files matched your search

+8 -8
View File
@@ -2377,7 +2377,7 @@ paths:
tags:
- Medications
summary: Register a new supply container
description: Creates an ACTIVE inventory item with `unitsRemaining = unitsTotal`. The request's `dosesTotal` field
description: Creates an ACTIVE inventory item with `unitsRemaining = unitsTotal`. The request's `unitsTotal` field
carries UNITS (1–1000). Rate-limited 30/min/user. Audits as `medication.inventory.create`.
parameters:
- in: path
@@ -2413,7 +2413,7 @@ paths:
- Medications
summary: Mutate a supply container
description: "Per-item operations: manual first-use (`markAsFirstUseAt`), used-up override (`markAsUsedUp`),
printed-expiry correction, absolute remaining-unit correction (`dosesRemaining`, clamped to the item's
printed-expiry correction, absolute remaining-unit correction (`unitsRemaining`, clamped to the item's
capacity), notes. The canonical state machine re-derives the state after every mutation. Audits as
`medication.inventory.update`."
parameters:
@@ -5177,12 +5177,12 @@ components:
CreateMedicationInventoryItemRequest:
type: object
properties:
dosesTotal:
unitsTotal:
type: integer
minimum: 1
maximum: 1000
description: Units the container ships with (tablets / ampoules / puffs; 1–1000). Stored as `unitsTotal`; dose-derived
readouts divide by the medication's `unitsPerDose`.
description: Units the container ships with (tablets / ampoules / puffs; 1–1000). Dose-derived readouts divide by the
medication's `unitsPerDose`.
containerType:
description: Kind of physical container (PEN / AMPOULE / BLISTER / INHALER / BOTTLE / OTHER). Display-level only;
defaults to OTHER.
@@ -5212,8 +5212,8 @@ components:
maxLength: 200
- type: "null"
required:
- dosesTotal
description: Register a new supply container (pen / blister pack / bottle). `dosesTotal` counts UNITS (1–1000); the item
- unitsTotal
description: Register a new supply container (pen / blister pack / bottle). `unitsTotal` counts UNITS (1–1000); the item
starts ACTIVE with `unitsRemaining = unitsTotal` and the intake consumption hook decrements it per taken dose.
UpdateMedicationInventoryItemRequest:
type: object
@@ -5233,7 +5233,7 @@ components:
format: date-time
pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
- type: "null"
dosesRemaining:
unitsRemaining:
description: Absolute remaining-unit correction (0–1000). Clamped server-side to the item's `unitsTotal`; the canonical
state machine re-derives the state (0 ⇒ USED_UP).
type: integer