fix: surface active beds on elder records
This commit is contained in:
@@ -202,6 +202,8 @@ export async function getOrdersWithItems(params: {
|
||||
|
||||
- `POST /api/admissions`: admit an elder or transfer an active elder to a new available bed.
|
||||
- `PATCH /api/admissions/[id]`: discharge an active admission and release its bed.
|
||||
- `GET /api/elders`: list elders with current active bed labels joined from `admissions -> beds -> rooms`.
|
||||
- `readData()`: compatibility read model must expose the same active bed labels on `Elder.room`, `Elder.bed`, and `Elder.bedId`.
|
||||
- Mutations use `getDatabase().transaction(async (transaction) => ...)`.
|
||||
|
||||
### 3. Contracts
|
||||
@@ -223,8 +225,10 @@ export async function getOrdersWithItems(params: {
|
||||
### 5. Good/Base/Bad Cases
|
||||
|
||||
- Good: return a typed mutation result from inside the transaction, then convert it to `jsonFailure` or `jsonSuccess` outside the transaction.
|
||||
- Good: display elder bed fields as read-only data derived from the active admission; bed assignment actions live in the bed/admission workspace.
|
||||
- Base: read-only admission lists may use the temporary `readData()` compatibility model while the domain helper layer is being extracted.
|
||||
- Bad: throw ordinary `Error` for business conflicts such as occupied beds, because it loses the structured status/reason contract.
|
||||
- Bad: allow free-text room/bed edits on the elder form when those strings are not persisted relationship data.
|
||||
|
||||
### 6. Tests Required
|
||||
|
||||
|
||||
Reference in New Issue
Block a user