From baa1ba018d50aa6be9e6822195c8c94bc81b1bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 14:32:52 +0200 Subject: [PATCH] test(medications): pin the today list, the compliance buckets and the status update before they move One walk through GET and POST /api/medications/intake: today's list with its projection and every status a row reads as, the compliance buckets cold and cached, a take in place, a take that re-binds to another slot, a pin and a pin that is no slot, a skip, both snoozes, the not-found answers, the record-only rule both ways, the injection-site refusal and an allowed site, the schema refusals, and a delegate marking an open dose and refused a snooze and a correction. --- ...edication-intake-status.01-today.json.snap | 685 ++++++++++++++ ...ntake-status.02a-compliance-cold.json.snap | 673 ++++++++++++++ ...ntake-status.02b-compliance-warm.json.snap | 673 ++++++++++++++ ...ication-intake-status.03-invalid.json.snap | 653 ++++++++++++++ ...ication-intake-status.04a-reader.json.snap | 685 ++++++++++++++ ...tion-intake-status.04b-anonymous.json.snap | 637 +++++++++++++ ...n-intake-status.11-take-in-place.json.snap | 716 +++++++++++++++ ...-intake-status.12-take-slot-move.json.snap | 740 ++++++++++++++++ ...medication-intake-status.13a-pin.json.snap | 776 ++++++++++++++++ ...intake-status.13b-pin-not-a-slot.json.snap | 727 +++++++++++++++ ...medication-intake-status.14-skip.json.snap | 792 +++++++++++++++++ ...n-intake-status.15a-snooze-until.json.snap | 784 ++++++++++++++++ ...intake-status.15b-snooze-default.json.snap | 794 +++++++++++++++++ ...cation-intake-status.16a-unknown.json.snap | 752 ++++++++++++++++ ...cation-intake-status.16b-foreign.json.snap | 752 ++++++++++++++++ ...ion-intake-status.16c-tombstoned.json.snap | 752 ++++++++++++++++ ...take-status.17a-record-only-open.json.snap | 752 ++++++++++++++++ ...tatus.17b-record-only-correction.json.snap | 822 +++++++++++++++++ ...take-status.18a-site-not-allowed.json.snap | 767 ++++++++++++++++ ...edication-intake-status.18b-site.json.snap | 836 ++++++++++++++++++ ...ication-intake-status.19-invalid.json.snap | 791 +++++++++++++++++ ...on-intake-status.20a-writer-take.json.snap | 830 +++++++++++++++++ ...status.20b-writer-snooze-refused.json.snap | 797 +++++++++++++++++ ...us.20c-writer-correction-refused.json.snap | 808 +++++++++++++++++ ...ication-intake-status.20d-reader.json.snap | 809 +++++++++++++++++ ...tion-intake-status.20e-anonymous.json.snap | 807 +++++++++++++++++ .../medication-intake-status.parity.test.ts | 477 ++++++++++ 27 files changed, 20087 insertions(+) create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.01-today.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.02a-compliance-cold.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.02b-compliance-warm.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.03-invalid.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.04a-reader.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.04b-anonymous.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.11-take-in-place.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.12-take-slot-move.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.13a-pin.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.13b-pin-not-a-slot.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.14-skip.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.15a-snooze-until.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.15b-snooze-default.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.16a-unknown.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.16b-foreign.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.16c-tombstoned.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.17a-record-only-open.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.17b-record-only-correction.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.18a-site-not-allowed.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.18b-site.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.19-invalid.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.20a-writer-take.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.20b-writer-snooze-refused.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.20c-writer-correction-refused.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.20d-reader.json.snap create mode 100644 tests/integration/routes/parity/__snapshots__/medication-intake-status.20e-anonymous.json.snap create mode 100644 tests/integration/routes/parity/medication-intake-status.parity.test.ts diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.01-today.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.01-today.json.snap new file mode 100644 index 000000000..542dd90b5 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.01-today.json.snap @@ -0,0 +1,685 @@ +{ + "status": 200, + "body": { + "data": [ + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "status": "missed", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "status": "snoozed", + "snoozedUntil": "2026-10-15T12:30:00.000Z" + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "status": "pending", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "status": "taken", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "status": "skipped", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "status": "snoozed", + "snoozedUntil": "2026-10-15T12:30:00.000Z" + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.today" + }, + "meta": { + "count": 6, + "projected": 6, + "backfilled": 0 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.02a-compliance-cold.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.02a-compliance-cold.json.snap new file mode 100644 index 000000000..6296a686c --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.02a-compliance-cold.json.snap @@ -0,0 +1,673 @@ +{ + "status": 200, + "body": { + "data": [ + { + "date": "2026-10-09", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-10", + "scheduled": 6, + "taken": 1 + }, + { + "date": "2026-10-11", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-12", + "scheduled": 6, + "taken": 1 + }, + { + "date": "2026-10-13", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-14", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-15", + "scheduled": 5, + "taken": 1 + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.compliance" + }, + "meta": { + "cache.medicationsIntake.outcome": "miss", + "cache.medicationsIntake.key_hash": "", + "days": 7, + "count": 7 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.02b-compliance-warm.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.02b-compliance-warm.json.snap new file mode 100644 index 000000000..20f1f535b --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.02b-compliance-warm.json.snap @@ -0,0 +1,673 @@ +{ + "status": 200, + "body": { + "data": [ + { + "date": "2026-10-09", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-10", + "scheduled": 6, + "taken": 1 + }, + { + "date": "2026-10-11", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-12", + "scheduled": 6, + "taken": 1 + }, + { + "date": "2026-10-13", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-14", + "scheduled": 6, + "taken": 0 + }, + { + "date": "2026-10-15", + "scheduled": 5, + "taken": 1 + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.compliance" + }, + "meta": { + "cache.medicationsIntake.outcome": "hit", + "cache.medicationsIntake.key_hash": "", + "days": 7, + "count": 7 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.03-invalid.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.03-invalid.json.snap new file mode 100644 index 000000000..9de2f573c --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.03-invalid.json.snap @@ -0,0 +1,653 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "scope", + "code": "invalid_value", + "message": "Invalid option: expected one of \"today\"|\"compliance\"" + }, + { + "path": "days", + "code": "too_small", + "message": "Too small: expected number to be >=1" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medications.intake.list.validation-failed" + }, + "meta": { + "issue_count": 2, + "rejected_attempt": "medications.intake.list.validation-failed" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.04a-reader.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.04a-reader.json.snap new file mode 100644 index 000000000..542dd90b5 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.04a-reader.json.snap @@ -0,0 +1,685 @@ +{ + "status": 200, + "body": { + "data": [ + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "status": "missed", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "status": "snoozed", + "snoozedUntil": "2026-10-15T12:30:00.000Z" + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "status": "pending", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "status": "taken", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "status": "skipped", + "snoozedUntil": null + }, + { + "id": "", + "medicationId": "", + "scheduledAt": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "status": "snoozed", + "snoozedUntil": "2026-10-15T12:30:00.000Z" + } + ], + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.today" + }, + "meta": { + "count": 6, + "projected": 6, + "backfilled": 0 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.04b-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.04b-anonymous.json.snap new file mode 100644 index 000000000..3016b5ab1 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.04b-anonymous.json.snap @@ -0,0 +1,637 @@ +{ + "status": 401, + "body": { + "data": null, + "error": "Not authenticated", + "meta": { + "errorCode": "auth.missing", + "requestId": "" + } + }, + "events": [ + { + "status": 401, + "action": null, + "meta": null, + "warnings": null, + "error": { + "type": "HttpError", + "message": "Not authenticated" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "30", + "firstUseAt": null, + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.11-take-in-place.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.11-take-in-place.json.snap new file mode 100644 index 000000000..6001b05ef --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.11-take-in-place.json.snap @@ -0,0 +1,716 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "medication_id": "", + "units": 1, + "item_ids": [ + "" + ], + "auto_opened": 1, + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "29", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.12-take-slot-move.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.12-take-slot-move.json.snap new file mode 100644 index 000000000..d6d98517a --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.12-take-slot-move.json.snap @@ -0,0 +1,740 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "idempotencyKey": null, + "scheduledFor": "2026-10-14T20:00:00.000Z", + "source": "WEB", + "createdAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "medication_id": "", + "units": 1, + "item_ids": [ + "" + ], + "auto_opened": 0, + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "28", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.13a-pin.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.13a-pin.json.snap new file mode 100644 index 000000000..666d31663 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.13a-pin.json.snap @@ -0,0 +1,776 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "idempotencyKey": null, + "scheduledFor": "2026-10-13T08:00:00.000Z", + "source": "WEB", + "createdAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "medication_id": "", + "units": 1, + "item_ids": [ + "" + ], + "auto_opened": 0, + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.13b-pin-not-a-slot.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.13b-pin-not-a-slot.json.snap new file mode 100644 index 000000000..11df637ed --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.13b-pin-not-a-slot.json.snap @@ -0,0 +1,727 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "forceSlotInstant is not a scheduled slot of this medication", + "meta": { + "errorCode": "medications.intake.force_slot.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medication.intake.force_slot.invalid" + }, + "meta": { + "medication_id": "", + "intake_id": "" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": "2026-10-12T08:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.14-skip.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.14-skip.json.snap new file mode 100644 index 000000000..522843f52 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.14-skip.json.snap @@ -0,0 +1,792 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "intakeId": "", + "status": "skipped" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "skipped" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.15a-snooze-until.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.15a-snooze-until.json.snap new file mode 100644 index 000000000..80c9de305 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.15a-snooze-until.json.snap @@ -0,0 +1,784 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "intakeId": "", + "status": "snoozed" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "snoozed" + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T13:00:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.15b-snooze-default.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.15b-snooze-default.json.snap new file mode 100644 index 000000000..7ab938329 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.15b-snooze-default.json.snap @@ -0,0 +1,794 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "intakeId": "", + "status": "snoozed" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "snoozed" + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.16a-unknown.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16a-unknown.json.snap new file mode 100644 index 000000000..fba272828 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16a-unknown.json.snap @@ -0,0 +1,752 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Intake event not found", + "meta": { + "errorCode": "http.not_found", + "requestId": "" + } + }, + "events": [ + { + "status": 404, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.16b-foreign.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16b-foreign.json.snap new file mode 100644 index 000000000..fba272828 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16b-foreign.json.snap @@ -0,0 +1,752 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Intake event not found", + "meta": { + "errorCode": "http.not_found", + "requestId": "" + } + }, + "events": [ + { + "status": 404, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.16c-tombstoned.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16c-tombstoned.json.snap new file mode 100644 index 000000000..fba272828 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.16c-tombstoned.json.snap @@ -0,0 +1,752 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Intake event not found", + "meta": { + "errorCode": "http.not_found", + "requestId": "" + } + }, + "events": [ + { + "status": 404, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.17a-record-only-open.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.17a-record-only-open.json.snap new file mode 100644 index 000000000..547106503 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.17a-record-only-open.json.snap @@ -0,0 +1,752 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "This medication is kept as a record; its intake is not tracked", + "meta": { + "errorCode": "medication.intake.notTracked", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.17b-record-only-correction.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.17b-record-only-correction.json.snap new file mode 100644 index 000000000..e314edc22 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.17b-record-only-correction.json.snap @@ -0,0 +1,822 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.18a-site-not-allowed.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.18a-site-not-allowed.json.snap new file mode 100644 index 000000000..df23d680d --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.18a-site-not-allowed.json.snap @@ -0,0 +1,767 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Injection site is not allowed for this medication", + "meta": { + "errorCode": "medications.intake.injection_site.disallowed", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medication.intake.injection_site.disallowed" + }, + "meta": { + "medication_id": "", + "site": "ABDOMEN_RIGHT" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.18b-site.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.18b-site.json.snap new file mode 100644 index 000000000..0579f7e56 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.18b-site.json.snap @@ -0,0 +1,836 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "medication_id": "", + "units": 0, + "item_ids": [], + "auto_opened": 0, + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.19-invalid.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.19-invalid.json.snap new file mode 100644 index 000000000..d124ccc0f --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.19-invalid.json.snap @@ -0,0 +1,791 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "intakeId", + "code": "too_small", + "message": "Too small: expected string to have >=1 characters" + }, + { + "path": "status", + "code": "invalid_value", + "message": "Invalid option: expected one of \"taken\"|\"skipped\"|\"snoozed\"" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": { + "name": "medications.intake.update.validation-failed" + }, + "meta": { + "issue_count": 2, + "rejected_attempt": "medications.intake.update.validation-failed" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": "2026-10-15T12:30:00.000Z", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "2026-10-15T08:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.20a-writer-take.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20a-writer-take.json.snap new file mode 100644 index 000000000..bd0c5ac92 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20a-writer-take.json.snap @@ -0,0 +1,830 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "takenAt": "", + "skipped": false, + "idempotencyKey": null, + "scheduledFor": "2026-10-15T08:00:00.000Z", + "source": "REMINDER", + "createdAt": "" + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medications.intake.update" + }, + "meta": { + "intakeId": "", + "status": "taken" + }, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "queueMedicationIntakeSync", + "args": [ + { + "userId": "", + "originDeviceToken": null + } + ] + }, + { + "effect": "countOutstandingDosesToday", + "args": [ + "", + "UTC" + ] + }, + { + "effect": "notifyDelegatedIntake", + "args": [ + { + "ownerId": "", + "actorId": "", + "medicationId": "", + "status": "taken" + } + ] + }, + { + "effect": "dispatchMedicationIntakeWebClear", + "args": [ + { + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "badgeCount": 2 + } + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.20b-writer-snooze-refused.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20b-writer-snooze-refused.json.snap new file mode 100644 index 000000000..8dd33d85b --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20b-writer-snooze-refused.json.snap @@ -0,0 +1,797 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "Snoozing a reminder is not part of shared access", + "meta": { + "errorCode": "sharing.not_permitted", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": { + "name": "medications.intake.update.refused" + }, + "meta": { + "reason": "snooze" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "snoozed", + "reason": "snooze" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.20c-writer-correction-refused.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20c-writer-correction-refused.json.snap new file mode 100644 index 000000000..4083a8d7e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20c-writer-correction-refused.json.snap @@ -0,0 +1,808 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "Changing a dose that is already recorded is not part of shared access", + "meta": { + "errorCode": "sharing.not_permitted", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": { + "name": "medications.intake.update.refused" + }, + "meta": { + "reason": "resolved_event" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "skipped", + "reason": "resolved_event" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "snoozed", + "reason": "snooze" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.20d-reader.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20d-reader.json.snap new file mode 100644 index 000000000..2f40671a2 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20d-reader.json.snap @@ -0,0 +1,809 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "Account access denied", + "meta": { + "errorCode": "sharing.access.denied", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": null, + "meta": { + "sharing_refusal": "insufficient_access" + }, + "warnings": null, + "error": { + "type": "SharingAccessDeniedError", + "message": "Account access denied" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "skipped", + "reason": "resolved_event" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "snoozed", + "reason": "snooze" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-intake-status.20e-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20e-anonymous.json.snap new file mode 100644 index 000000000..76f803a7e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-intake-status.20e-anonymous.json.snap @@ -0,0 +1,807 @@ +{ + "status": 401, + "body": { + "data": null, + "error": "Not authenticated", + "meta": { + "errorCode": "auth.missing", + "requestId": "" + } + }, + "events": [ + { + "status": 401, + "action": null, + "meta": null, + "warnings": null, + "error": { + "type": "HttpError", + "message": "Not authenticated" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "Daily pen", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT", + "ABDOMEN_RIGHT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": false, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Three times", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Twice daily", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": false, + "autoMarkTakenSince": null, + "deliveryForm": "INJECTION", + "trackInjectionSites": true, + "allowedInjectionSites": [ + "ABDOMEN_LEFT" + ], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "06:00", + "windowEnd": "07:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "06:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "07:00", + "windowEnd": "08:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "10:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "10:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "13:00", + "windowEnd": "14:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "13:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + } + ], + "revisions": [], + "pauseEras": [], + "courses": [], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-09T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "2026-10-09T09:00:00.000Z" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T08:00:00.000Z", + "takenAt": "2026-10-10T08:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-11T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-12T08:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T07:00:00.000Z", + "takenAt": "2026-10-13T07:20:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T08:00:00.000Z", + "takenAt": "2026-10-13T11:00:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-13T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T07:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T08:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T20:00:00.000Z", + "takenAt": "2026-10-14T20:30:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": true, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T08:00:00.000Z", + "takenAt": "", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": [ + { + "units": 1, + "itemId": "" + } + ], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T09:00:00.000Z", + "takenAt": "2026-10-15T09:15:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": "ABDOMEN_LEFT", + "doseTaken": null, + "inventoryConsumption": [], + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T10:00:00.000Z", + "takenAt": "2026-10-15T10:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T13:00:00.000Z", + "takenAt": null, + "skipped": true, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T20:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "REMINDER", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "IN_USE", + "containerType": "OTHER", + "unitsTotal": "30", + "unitsRemaining": "27", + "firstUseAt": "2026-10-15T08:30:00.000Z", + "expiresAt": null, + "printedExpiry": null, + "purchasedAt": "2026-10-01T06:00:00.000Z", + "manufacturer": null, + "doseStrength": null, + "notes": null, + "notesEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "inventoryEvents": [], + "categories": [], + "ingredients": [], + "audit": [ + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "skipped" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "snoozed" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update", + "userId": "", + "actorUserId": null, + "details": { + "intakeId": "", + "status": "taken" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "skipped", + "reason": "resolved_event" + }, + "ipAddress": null + }, + { + "action": "medications.intake.update.refused", + "userId": "", + "actorUserId": "", + "details": { + "intakeId": "", + "status": "snoozed", + "reason": "snooze" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/medication-intake-status.parity.test.ts b/tests/integration/routes/parity/medication-intake-status.parity.test.ts new file mode 100644 index 000000000..b83135251 --- /dev/null +++ b/tests/integration/routes/parity/medication-intake-status.parity.test.ts @@ -0,0 +1,477 @@ +/** + * Parity for `GET` and `POST /api/medications/intake` while the today list, + * the compliance buckets and the status update move into + * `src/lib/medications/`. + * + * One record walks through the cases the route tells apart, in order, each + * request seeing what the earlier ones stored. The reads: today's list (with + * the projection it runs, and every status a row can read as), the + * compliance buckets cold and from the cache, a query the schema refuses, a + * reading delegate and nobody. The updates: a take in place, a take that + * re-binds to another slot (tombstone and converge, the recorded site + * carried), a pinned take and a pin that is no slot, a skip over a recorded + * dose, a snooze with and without its end, the not-found answers (an unknown + * event, another account's, a tombstoned one), the record-only rule both + * ways, the injection-site refusal and an allowed site, a body the schema + * refuses, and a delegate who marks an open dose, is refused a snooze and a + * correction, a reader and nobody. + * + * After each request the snapshot holds the response, the wide event, the + * recorded tails and every medication row of the accounts. The clock is + * pinned (`Date` only), so the snapshot is the same on every day it runs. + */ +import { afterAll, beforeAll, describe, it, vi } from "vitest"; + +import { GET, POST } from "@/app/api/medications/intake/route"; + +import { anonymous, type RouteAuth } from "../../../kit/call-route"; +import { makeMedication, makeSession, makeUser } from "../../../kit/factories"; +import { getPrismaClient, truncateAllTables } from "../../setup"; +import { delegateOf, parityStep } from "./medication-state"; + +vi.mock("@/lib/logging/transports", async (importOriginal) => { + const actual = + await importOriginal(); + const { wideEventRecorder: recorder } = await import("../../../kit/parity"); + return { + ...actual, + emitIfSampled: (event: (typeof recorder.events)[number]) => { + recorder.events.push(event); + }, + }; +}); + +// The tails the route starts without awaiting them (the cross-device push, +// the web-push dose clear with its badge count, the owner's notification of a +// delegated dose), recorded instead of run (see `effectRecorder`). +vi.mock( + "@/lib/notifications/medication-intake-sync", + async (importOriginal) => { + const actual = + await importOriginal< + typeof import("@/lib/notifications/medication-intake-sync") + >(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + queueMedicationIntakeSync: (...args: unknown[]) => { + effectRecorder.record("queueMedicationIntakeSync", args); + }, + }; + }, +); +vi.mock("@/lib/notifications/web-push-clear", async (importOriginal) => { + const actual = + await importOriginal(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + dispatchMedicationIntakeWebClear: async (...args: unknown[]) => { + effectRecorder.record("dispatchMedicationIntakeWebClear", args); + }, + }; +}); +vi.mock("@/lib/medications/outstanding-doses", async (importOriginal) => { + const actual = + await importOriginal< + typeof import("@/lib/medications/outstanding-doses") + >(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + countOutstandingDosesToday: async (...args: unknown[]) => { + effectRecorder.record("countOutstandingDosesToday", args); + return 2; + }, + }; +}); +vi.mock("@/lib/notifications/delegated-intake", async (importOriginal) => { + const actual = + await importOriginal< + typeof import("@/lib/notifications/delegated-intake") + >(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + notifyDelegatedIntake: async (...args: unknown[]) => { + effectRecorder.record("notifyDelegatedIntake", args); + }, + }; +}); + +const prisma = getPrismaClient(); +const NOW = new Date("2026-10-15T12:00:00.000Z"); +const ROUTE = "/api/medications/intake"; + +let ownerId: string; +let userIds: string[]; +let owner: RouteAuth; +let writer: { auth: RouteAuth; headers: Record }; +let reader: { auth: RouteAuth; headers: Record }; +const ev: Record = {}; + +type Caller = { auth?: RouteAuth; headers?: Record }; + +async function get( + name: string, + query: Record, + caller: Caller = {}, +) { + await parityStep({ + name: `medication-intake-status.${name}`, + handler: GET, + options: { + method: "GET", + route: ROUTE, + query, + auth: caller.auth ?? owner, + headers: caller.headers, + }, + userIds, + now: NOW, + }); +} + +/** + * A take that re-binds to another slot answers with the row the shared slot + * write returns, which carries fewer fields than the registered event + * resource. The parity snapshot pins that answer as it is; the contract check + * is the route's own tests' business. + */ +const SLOT_MOVE_ANSWER = { + skip: "a slot move answers with the narrower slot-write row", +}; + +async function post( + name: string, + body: unknown, + caller: Caller & { contract?: { skip: string } } = {}, +) { + await parityStep({ + name: `medication-intake-status.${name}`, + handler: POST, + options: { + method: "POST", + route: ROUTE, + body, + auth: caller.auth ?? owner, + headers: caller.headers, + contract: caller.contract, + }, + userIds, + now: NOW, + }); +} + +async function intake( + key: string, + medicationId: string, + data: { + scheduledFor: string; + takenAt?: string; + skipped?: boolean; + autoMissed?: boolean; + deletedAt?: string; + injectionSite?: "ABDOMEN_LEFT"; + userId?: string; + }, +) { + const row = await prisma.medicationIntakeEvent.create({ + data: { + userId: data.userId ?? ownerId, + medicationId, + scheduledFor: new Date(data.scheduledFor), + takenAt: data.takenAt ? new Date(data.takenAt) : null, + skipped: data.skipped ?? false, + autoMissed: data.autoMissed ?? false, + deletedAt: data.deletedAt ? new Date(data.deletedAt) : null, + injectionSite: data.injectionSite ?? null, + source: "REMINDER", + createdAt: new Date("2026-10-01T06:00:00.000Z"), + }, + }); + ev[key] = row.id; +} + +const daily = (time: string, windowEnd: string) => ({ + windowStart: time, + windowEnd, + timesOfDay: [time], + rrule: "FREQ=DAILY", +}); + +beforeAll(async () => { + vi.useFakeTimers({ toFake: ["Date"], now: NOW }); + await truncateAllTables(prisma); + const user = await makeUser({ timezone: "UTC" }); + ownerId = user.id; + owner = await makeSession(user); + const created = new Date("2026-10-01T06:00:00.000Z"); + + const twice = await makeMedication( + user, + { + name: "Twice daily", + startsOn: new Date("2026-10-01"), + createdAt: created, + snoozedUntil: new Date("2026-10-15T12:30:00.000Z"), + deliveryForm: "INJECTION", + trackInjectionSites: true, + allowedInjectionSites: ["ABDOMEN_LEFT"], + }, + [daily("08:00", "10:00"), daily("20:00", "22:00")], + ); + await prisma.medicationInventoryItem.create({ + data: { + userId: ownerId, + medicationId: twice.id, + unitsTotal: 30, + unitsRemaining: 30, + purchasedAt: created, + }, + }); + await intake("todayMorning", twice.id, { + scheduledFor: "2026-10-15T08:00:00.000Z", + }); + await intake("todayEvening", twice.id, { + scheduledFor: "2026-10-15T20:00:00.000Z", + }); + await intake("moveMe", twice.id, { + scheduledFor: "2026-10-14T08:00:00.000Z", + injectionSite: "ABDOMEN_LEFT", + }); + await intake("pinMe", twice.id, { + scheduledFor: "2026-10-13T20:00:00.000Z", + }); + await intake("skipMe", twice.id, { + scheduledFor: "2026-10-12T08:00:00.000Z", + takenAt: "2026-10-12T08:10:00.000Z", + }); + await intake("snoozeMe", twice.id, { + scheduledFor: "2026-10-11T08:00:00.000Z", + }); + await intake("resolved", twice.id, { + scheduledFor: "2026-10-10T08:00:00.000Z", + takenAt: "2026-10-10T08:05:00.000Z", + }); + await intake("tombstoned", twice.id, { + scheduledFor: "2026-10-09T08:00:00.000Z", + deletedAt: "2026-10-09T09:00:00.000Z", + }); + + const pen = await makeMedication( + user, + { + name: "Daily pen", + startsOn: new Date("2026-10-01"), + createdAt: created, + deliveryForm: "INJECTION", + trackInjectionSites: true, + allowedInjectionSites: ["ABDOMEN_LEFT", "ABDOMEN_RIGHT"], + }, + [daily("09:00", "11:00")], + ); + await intake("penToday", pen.id, { + scheduledFor: "2026-10-15T09:00:00.000Z", + }); + await prisma.user.update({ + where: { id: ownerId }, + data: { globalExcludedInjectionSites: ["ABDOMEN_RIGHT"] }, + }); + + const mixed = await makeMedication( + user, + { + name: "Three times", + startsOn: new Date("2026-10-01"), + createdAt: created, + }, + [daily("06:00", "07:00"), daily("10:00", "11:00"), daily("13:00", "14:00")], + ); + await intake("missed", mixed.id, { + scheduledFor: "2026-10-15T06:00:00.000Z", + autoMissed: true, + }); + await intake("taken", mixed.id, { + scheduledFor: "2026-10-15T10:00:00.000Z", + takenAt: "2026-10-15T10:05:00.000Z", + }); + await intake("skipped", mixed.id, { + scheduledFor: "2026-10-15T13:00:00.000Z", + skipped: true, + }); + + const recordOnly = await makeMedication( + user, + { name: "Record only", createdAt: created, trackIntake: false }, + [daily("07:00", "08:00")], + ); + await intake("recordOpen", recordOnly.id, { + scheduledFor: "2026-10-14T07:00:00.000Z", + }); + await intake("recordTaken", recordOnly.id, { + scheduledFor: "2026-10-13T07:00:00.000Z", + takenAt: "2026-10-13T07:05:00.000Z", + }); + + const stranger = await makeUser({ timezone: "UTC" }); + const foreign = await makeMedication(stranger, { name: "Not yours" }); + await intake("foreign", foreign.id, { + scheduledFor: "2026-10-15T08:00:00.000Z", + userId: stranger.id, + }); + + const w = await delegateOf(prisma, user, "WRITE"); + const r = await delegateOf(prisma, user, "READ"); + writer = { auth: w.auth, headers: w.headers }; + reader = { auth: r.auth, headers: r.headers }; + userIds = [ownerId, w.delegate.id, r.delegate.id]; +}); + +afterAll(() => { + vi.useRealTimers(); +}); + +describe("GET /api/medications/intake parity", () => { + it("01 today's list", async () => { + await get("01-today", { scope: "today" }); + }); + + it("02 the compliance buckets, cold and from the cache", async () => { + await get("02a-compliance-cold", { scope: "compliance", days: "7" }); + await get("02b-compliance-warm", { scope: "compliance", days: "7" }); + }); + + it("03 a query the schema refuses", async () => { + await get("03-invalid", { scope: "yesterday", days: "0" }); + }); + + it("04 a reading delegate, and nobody", async () => { + await get("04a-reader", { scope: "today" }, reader); + await get("04b-anonymous", { scope: "today" }, { auth: anonymous }); + }); +}); + +describe("POST /api/medications/intake parity", () => { + it("11 a take in place", async () => { + await post("11-take-in-place", { + intakeId: ev.todayMorning, + status: "taken", + takenAt: "2026-10-15T08:30:00.000Z", + }); + }); + + it("12 a take that re-binds to another slot", async () => { + await post( + "12-take-slot-move", + { + intakeId: ev.moveMe, + status: "taken", + takenAt: "2026-10-14T20:30:00.000Z", + }, + { contract: SLOT_MOVE_ANSWER }, + ); + }); + + it("13 a pinned take, and a pin that is no slot", async () => { + await post( + "13a-pin", + { + intakeId: ev.pinMe, + status: "taken", + takenAt: "2026-10-13T11:00:00.000Z", + forceSlotInstant: "2026-10-13T08:00:00.000Z", + }, + { contract: SLOT_MOVE_ANSWER }, + ); + await post("13b-pin-not-a-slot", { + intakeId: ev.snoozeMe, + status: "taken", + forceSlotInstant: "2026-10-11T15:00:00.000Z", + }); + }); + + it("14 a skip over a recorded dose", async () => { + await post("14-skip", { intakeId: ev.skipMe, status: "skipped" }); + }); + + it("15 a snooze with its end, and one without", async () => { + await post("15a-snooze-until", { + intakeId: ev.snoozeMe, + status: "snoozed", + snoozedUntil: "2026-10-15T13:00:00.000Z", + }); + await post("15b-snooze-default", { + intakeId: ev.snoozeMe, + status: "snoozed", + }); + }); + + it("16 the not-found answers", async () => { + await post("16a-unknown", { + intakeId: "cmv0000000000000000000000", + status: "taken", + }); + await post("16b-foreign", { intakeId: ev.foreign, status: "taken" }); + await post("16c-tombstoned", { intakeId: ev.tombstoned, status: "taken" }); + }); + + it("17 the record-only rule both ways", async () => { + await post("17a-record-only-open", { + intakeId: ev.recordOpen, + status: "taken", + }); + await post("17b-record-only-correction", { + intakeId: ev.recordTaken, + status: "taken", + takenAt: "2026-10-13T07:20:00.000Z", + }); + }); + + it("18 the injection-site refusal, and an allowed site", async () => { + await post("18a-site-not-allowed", { + intakeId: ev.penToday, + status: "taken", + takenAt: "2026-10-15T09:15:00.000Z", + injectionSite: "ABDOMEN_RIGHT", + }); + await post("18b-site", { + intakeId: ev.penToday, + status: "taken", + takenAt: "2026-10-15T09:15:00.000Z", + injectionSite: "ABDOMEN_LEFT", + }); + }); + + it("19 a body the schema refuses", async () => { + await post("19-invalid", { intakeId: "", status: "forgotten" }); + }); + + it("20 a delegate who marks an open dose, a snooze, a correction, a reader and nobody", async () => { + await post( + "20a-writer-take", + { intakeId: ev.todayEvening, status: "taken" }, + { ...writer, contract: SLOT_MOVE_ANSWER }, + ); + await post( + "20b-writer-snooze-refused", + { intakeId: ev.snoozeMe, status: "snoozed" }, + writer, + ); + await post( + "20c-writer-correction-refused", + { intakeId: ev.resolved, status: "skipped" }, + writer, + ); + await post( + "20d-reader", + { intakeId: ev.snoozeMe, status: "taken" }, + reader, + ); + await post( + "20e-anonymous", + { intakeId: ev.snoozeMe, status: "taken" }, + { auth: anonymous }, + ); + }); +});