diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.01-rolling.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.01-rolling.json.snap new file mode 100644 index 000000000..7d5a09722 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.01-rolling.json.snap @@ -0,0 +1,699 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "nextDueAt": "2026-10-17T07:00:00.000Z", + "remindersActive": false, + "nextDueOverdue": false, + "courseStatus": "CURRENT", + "intakeActionable": true, + "stockUnitsRemaining": 3, + "stockDosesRemaining": 3, + "runwayDays": 21, + "ingredients": [ + { + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "labelKey": "nutrients.names.vitamin_d", + "label": "Vitamin D" + } + ], + "related": [] + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.get", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.02-daily.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.02-daily.json.snap new file mode 100644 index 000000000..618a09d7a --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.02-daily.json.snap @@ -0,0 +1,710 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet", + "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": "", + "schedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + }, + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "nextDueAt": "2026-10-15T18:00:00.000Z", + "remindersActive": true, + "nextDueOverdue": false, + "courseStatus": "CURRENT", + "intakeActionable": true, + "stockUnitsRemaining": null, + "stockDosesRemaining": null, + "runwayDays": null, + "ingredients": [], + "related": [] + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.get", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.03-record-only.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.03-record-only.json.snap new file mode 100644 index 000000000..9b038c771 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.03-record-only.json.snap @@ -0,0 +1,690 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Record only", + "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": 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": "", + "schedules": [], + "recordedSchedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "nextDueAt": null, + "remindersActive": false, + "nextDueOverdue": false, + "courseStatus": "CURRENT", + "intakeActionable": false, + "stockUnitsRemaining": null, + "stockDosesRemaining": null, + "runwayDays": null, + "ingredients": [], + "related": [] + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.get", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.04-not-found.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.04-not-found.json.snap new file mode 100644 index 000000000..4be62bf07 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.04-not-found.json.snap @@ -0,0 +1,617 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Medication 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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.05a-reader.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.05a-reader.json.snap new file mode 100644 index 000000000..7d5a09722 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.05a-reader.json.snap @@ -0,0 +1,699 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false, + "nextDueAt": "2026-10-17T07:00:00.000Z", + "remindersActive": false, + "nextDueOverdue": false, + "courseStatus": "CURRENT", + "intakeActionable": true, + "stockUnitsRemaining": 3, + "stockDosesRemaining": 3, + "runwayDays": 21, + "ingredients": [ + { + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "labelKey": "nutrients.names.vitamin_d", + "label": "Vitamin D" + } + ], + "related": [] + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.get", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.05b-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.05b-anonymous.json.snap new file mode 100644 index 000000000..408d19cc6 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.05b-anonymous.json.snap @@ -0,0 +1,620 @@ +{ + "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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet", + "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": "Record only", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.11-plain-fields.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.11-plain-fields.json.snap new file mode 100644 index 000000000..caac60735 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.11-plain-fields.json.snap @@ -0,0 +1,718 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + }, + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "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": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.12-schedule-replace.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.12-schedule-replace.json.snap new file mode 100644 index 000000000..9253f75d6 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.12-schedule-replace.json.snap @@ -0,0 +1,794 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 30, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 2 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 30, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.13-schedule-echo.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.13-schedule-echo.json.snap new file mode 100644 index 000000000..76cbe084b --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.13-schedule-echo.json.snap @@ -0,0 +1,808 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 30, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 30, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.14-grace-bridge.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.14-grace-bridge.json.snap new file mode 100644 index 000000000..9592315ae --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.14-grace-bridge.json.snap @@ -0,0 +1,819 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.15a-pause.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.15a-pause.json.snap new file mode 100644 index 000000000..58c4631c6 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.15a-pause.json.snap @@ -0,0 +1,843 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": false, + "notificationsEnabled": false, + "pausedAt": "", + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": false, + "notificationsEnabled": false, + "pausedAt": "", + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": null, + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.15b-resume.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.15b-resume.json.snap new file mode 100644 index 000000000..80d5f956d --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.15b-resume.json.snap @@ -0,0 +1,858 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "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": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.16-auto-mark-taken.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.16-auto-mark-taken.json.snap new file mode 100644 index 000000000..f960f6d45 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.16-auto-mark-taken.json.snap @@ -0,0 +1,873 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.17a-custom-category.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.17a-custom-category.json.snap new file mode 100644 index 000000000..41c112d3d --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.17a-custom-category.json.snap @@ -0,0 +1,889 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.17b-native-other-kept.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.17b-native-other-kept.json.snap new file mode 100644 index 000000000..e537872e2 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.17b-native-other-kept.json.snap @@ -0,0 +1,902 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "entity_id": "" + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.17c-web-other.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.17c-web-other.json.snap new file mode 100644 index 000000000..aa42bd9a1 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.17c-web-other.json.snap @@ -0,0 +1,911 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.17d-unknown-category.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.17d-unknown-category.json.snap new file mode 100644 index 000000000..42df8b7a2 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.17d-unknown-category.json.snap @@ -0,0 +1,822 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Unknown medication category", + "meta": { + "errorCode": "medications.category.unknown", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "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": "2026-10-01T00:00:00.000Z", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.18a-record-schedule-kept.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.18a-record-schedule-kept.json.snap new file mode 100644 index 000000000..812cf0903 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.18a-record-schedule-kept.json.snap @@ -0,0 +1,904 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "", + "schedules": [], + "recordedSchedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "dropped_schedules": true, + "dropped_as_needed": false, + "dropped_one_shot": true + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.18b-tracking-on.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.18b-tracking-on.json.snap new file mode 100644 index 000000000..152c79133 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.18b-tracking-on.json.snap @@ -0,0 +1,927 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": "", + "schedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 0, + "track_intake": true + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.18c-tracking-off.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.18c-tracking-off.json.snap new file mode 100644 index 000000000..160f86063 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.18c-tracking-off.json.snap @@ -0,0 +1,971 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "", + "schedules": [], + "recordedSchedules": [ + { + "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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 1, + "track_intake": false + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.19a-scheduled-without-schedules.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.19a-scheduled-without-schedules.json.snap new file mode 100644 index 000000000..a114b01cb --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.19a-scheduled-without-schedules.json.snap @@ -0,0 +1,905 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A scheduled medication requires at least one schedule", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.19b-scheduled.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.19b-scheduled.json.snap new file mode 100644 index 000000000..18bea73e4 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.19b-scheduled.json.snap @@ -0,0 +1,1019 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "As needed", + "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": 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": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 0 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "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": 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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "08:00", + "windowEnd": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.19c-as-needed-keeping-schedules.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.19c-as-needed-keeping-schedules.json.snap new file mode 100644 index 000000000..fbcedbd50 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.19c-as-needed-keeping-schedules.json.snap @@ -0,0 +1,955 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "An as-needed medication cannot carry schedules (send schedules: [] to clear them)", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "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": 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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "08:00", + "windowEnd": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.19d-as-needed.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.19d-as-needed.json.snap new file mode 100644 index 000000000..f1c85281a --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.19d-as-needed.json.snap @@ -0,0 +1,1025 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "", + "schedules": [], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 1 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.20a-one-shot-two-schedules.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.20a-one-shot-two-schedules.json.snap new file mode 100644 index 000000000..bf46e1b89 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.20a-one-shot-two-schedules.json.snap @@ -0,0 +1,983 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A one-shot medication can have at most one schedule", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.20b-one-shot-recurrence.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.20b-one-shot-recurrence.json.snap new file mode 100644 index 000000000..a7639f5bc --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.20b-one-shot-recurrence.json.snap @@ -0,0 +1,983 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A one-shot medication cannot have a recurrence (rrule or rollingIntervalDays)", + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "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": 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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10: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": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.20c-one-shot.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.20c-one-shot.json.snap new file mode 100644 index 000000000..7ca869539 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.20c-one-shot.json.snap @@ -0,0 +1,1114 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [ + { + "id": "", + "startsOn": "2026-10-20", + "endsOn": "2026-10-20", + "status": "UPCOMING", + "takenDoses": 0, + "note": null + } + ], + "courseCount": 1, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": { + "schedule_revision_rows": 1 + }, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.21a-course-overlap.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.21a-course-overlap.json.snap new file mode 100644 index 000000000..95ee616b8 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.21a-course-overlap.json.snap @@ -0,0 +1,1041 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Courses may not share a day", + "meta": { + "errorCode": "medications.course.overlap", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.21b-course-window-required.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.21b-course-window-required.json.snap new file mode 100644 index 000000000..29c9db892 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.21b-course-window-required.json.snap @@ -0,0 +1,1041 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "A medication with several courses keeps a start date; delete a course instead", + "meta": { + "errorCode": "medications.course.windowRequired", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.21c-course-end.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.21c-course-end.json.snap new file mode 100644 index 000000000..e89aacbc9 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.21c-course-end.json.snap @@ -0,0 +1,1135 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "08:00", + "windowEnd": "09: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, + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [ + { + "id": "", + "startsOn": "2026-08-01", + "endsOn": "2026-08-31", + "status": "ENDED", + "takenDoses": 0, + "note": null + }, + { + "id": "", + "startsOn": "2026-10-01", + "endsOn": "2026-12-31", + "status": "CURRENT", + "takenDoses": 0, + "note": null + } + ], + "courseCount": 2, + "previousCourseEndedOn": "2026-08-31", + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "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": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.22-composition-units.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.22-composition-units.json.snap new file mode 100644 index 000000000..50d79355e --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.22-composition-units.json.snap @@ -0,0 +1,1136 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": 2, + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "09:00", + "windowEnd": "11:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + } + ], + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "categoryLabel": "Heart and circulation", + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "enqueueSupplementNutrientRecompute", + "args": [ + "" + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.23a-invalid.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.23a-invalid.json.snap new file mode 100644 index 000000000..0967c7eaa --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.23a-invalid.json.snap @@ -0,0 +1,1086 @@ +{ + "status": 422, + "body": { + "data": null, + "error": "Validation failed", + "details": { + "issues": [ + { + "path": "name", + "code": "too_small", + "message": "Too small: expected string to have >=1 characters" + }, + { + "path": "unitsPerDose", + "code": "custom", + "message": "unitsPerDose must be above 0 and at most 100, with at most 4 decimal places (e.g. 1, 0.5, 1.5, 2.25)" + }, + { + "path": "schedules", + "code": "invalid_type", + "message": "Invalid input: expected array, received string" + } + ] + }, + "meta": { + "errorCode": "http.invalid", + "requestId": "" + } + }, + "events": [ + { + "status": 422, + "action": null, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.23b-not-found.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.23b-not-found.json.snap new file mode 100644 index 000000000..9848e8212 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.23b-not-found.json.snap @@ -0,0 +1,1067 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Medication 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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.24a-writer.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.24a-writer.json.snap new file mode 100644 index 000000000..28c205ead --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.24a-writer.json.snap @@ -0,0 +1,1072 @@ +{ + "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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Daily tablet renamed", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.24b-manager.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.24b-manager.json.snap new file mode 100644 index 000000000..46f368ca1 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.24b-manager.json.snap @@ -0,0 +1,1171 @@ +{ + "status": 200, + "body": { + "data": { + "id": "", + "userId": "", + "name": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": 1, + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "", + "schedules": [ + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": 2, + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null, + "resolvedUnitsPerDose": 2 + }, + { + "id": "", + "medicationId": "", + "windowStart": "20:00", + "windowEnd": "22:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ], + "resolvedUnitsPerDose": 1 + } + ], + "category": "OTHER", + "categoryLabel": null, + "courses": [], + "courseCount": 0, + "previousCourseEndedOn": null, + "canStartCourse": false + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.update", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.24c-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.24c-anonymous.json.snap new file mode 100644 index 000000000..028da3263 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.24c-anonymous.json.snap @@ -0,0 +1,1085 @@ +{ + "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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "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": "To delete", + "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": 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": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "rrule": "FREQ=DAILY", + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "12:00", + "windowEnd": "13:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "12: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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "magnesium", + "amountPerUnit": 100, + "unit": "mg", + "enteredAmount": null, + "enteredUnit": null, + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + } +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.31-delete.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.31-delete.json.snap new file mode 100644 index 000000000..4459480a0 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.31-delete.json.snap @@ -0,0 +1,1050 @@ +{ + "status": 200, + "body": { + "data": { + "deleted": true + }, + "error": null + }, + "events": [ + { + "status": 200, + "action": { + "name": "medication.delete", + "entity_type": "medication", + "entity_id": "" + }, + "meta": null, + "warnings": null, + "error": null + } + ], + "effects": [ + { + "effect": "enqueueSupplementNutrientRecompute", + "args": [ + "" + ] + } + ], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.delete", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "To delete" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + }, + "extra": [ + { + "name": "kit-ingest", + "permissions": [ + "medication::ingest" + ], + "revoked": true + }, + { + "name": "kit-phone", + "permissions": [ + "*" + ], + "revoked": false + } + ] +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.32-not-found.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.32-not-found.json.snap new file mode 100644 index 000000000..5f7a74b90 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.32-not-found.json.snap @@ -0,0 +1,1041 @@ +{ + "status": 404, + "body": { + "data": null, + "error": "Medication 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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.delete", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "To delete" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + }, + "extra": [ + { + "name": "kit-ingest", + "permissions": [ + "medication::ingest" + ], + "revoked": true + }, + { + "name": "kit-phone", + "permissions": [ + "*" + ], + "revoked": false + } + ] +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.33a-manager.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.33a-manager.json.snap new file mode 100644 index 000000000..849675a62 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.33a-manager.json.snap @@ -0,0 +1,1046 @@ +{ + "status": 403, + "body": { + "data": null, + "error": "This endpoint cannot be used while acting on another account", + "meta": { + "errorCode": "sharing.not_permitted", + "requestId": "" + } + }, + "events": [ + { + "status": 403, + "action": null, + "meta": { + "sharing_refusal": "undeclared_mode" + }, + "warnings": null, + "error": { + "type": "SharingNotPermittedError", + "message": "This endpoint cannot be used while acting on another account" + } + } + ], + "effects": [], + "stored": { + "medications": [ + { + "id": "", + "userId": "", + "name": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.delete", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "To delete" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + }, + "extra": [ + { + "name": "kit-ingest", + "permissions": [ + "medication::ingest" + ], + "revoked": true + }, + { + "name": "kit-phone", + "permissions": [ + "*" + ], + "revoked": false + } + ] +} diff --git a/tests/integration/routes/parity/__snapshots__/medication-detail.33b-anonymous.json.snap b/tests/integration/routes/parity/__snapshots__/medication-detail.33b-anonymous.json.snap new file mode 100644 index 000000000..29eef6fb4 --- /dev/null +++ b/tests/integration/routes/parity/__snapshots__/medication-detail.33b-anonymous.json.snap @@ -0,0 +1,1044 @@ +{ + "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": "As needed", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": null, + "endsOn": null, + "oneShot": false, + "asNeeded": true, + "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": "Booster", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "oneShot": true, + "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": "By a manager", + "dose": "20mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": 30, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": false, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "", + "deliveryForm": "ORAL", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": true, + "criticalAlarmEnabled": true, + "atcCode": "C09AA05", + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": 5, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "userId": "", + "name": "Course tablet", + "dose": "10mg", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "1", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "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": "Record only renamed", + "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": 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": "Rolling pen", + "dose": "1 pen", + "treatmentClass": "GENERIC", + "dosesPerUnit": null, + "unitsPerDose": "2", + "active": true, + "notificationsEnabled": true, + "pausedAt": null, + "snoozedUntil": null, + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": null, + "oneShot": false, + "asNeeded": false, + "trackIntake": true, + "autoMarkTaken": true, + "autoMarkTakenSince": "2026-10-01T06:00:00.000Z", + "deliveryForm": "INJECTION", + "trackInjectionSites": false, + "allowedInjectionSites": [], + "liveActivityEnabled": false, + "criticalAlarmEnabled": false, + "atcCode": null, + "rxNormCode": null, + "lowStockNotifiedAt": null, + "lowStockNotifiedThresholdDays": null, + "reorderLeadDays": null, + "externalSource": null, + "externalId": null, + "createdAt": "", + "updatedAt": "" + } + ], + "schedules": [ + { + "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": "09: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": "10:00", + "label": null, + "dose": null, + "unitsPerDose": null, + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "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": null, + "rollingIntervalDays": 7, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": null + }, + { + "id": "", + "medicationId": "", + "windowStart": "11:30", + "windowEnd": "11:30", + "label": "Late morning", + "dose": "10mg", + "unitsPerDose": "2", + "daysOfWeek": null, + "timesOfDay": [ + "11:30" + ], + "reminderGraceMinutes": 45, + "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": "i2;1,3,5", + "timesOfDay": [ + "20:00" + ], + "reminderGraceMinutes": null, + "rrule": null, + "rollingIntervalDays": null, + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "doseWindows": [ + { + "end": "21:00", + "start": "19:30", + "timeOfDay": "20:00" + } + ] + } + ], + "revisions": [ + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + }, + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "22:00", + "daysOfWeek": null, + "timesOfDay": [ + "20:00" + ], + "doseWindows": null, + "windowStart": "20:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "2026-10-01T06:00:00.000Z", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "10:00", + "daysOfWeek": null, + "timesOfDay": [ + "09:00" + ], + "doseWindows": null, + "windowStart": "09:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "08:00", + "daysOfWeek": null, + "timesOfDay": [ + "07:00" + ], + "doseWindows": null, + "windowStart": "07:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + }, + { + "id": "", + "medicationId": "", + "validFrom": "", + "validUntil": "", + "payload": [ + { + "dose": null, + "label": null, + "rrule": "FREQ=DAILY", + "windowEnd": "09:00", + "daysOfWeek": null, + "timesOfDay": [ + "08:00" + ], + "doseWindows": null, + "windowStart": "08:00", + "scheduleType": "SCHEDULED", + "cyclicOnWeeks": null, + "cyclicOffWeeks": null, + "rollingIntervalDays": null, + "reminderGraceMinutes": null + } + ], + "source": "ARCHIVED", + "supersededByRevisionId": null, + "createdAt": "" + } + ], + "pauseEras": [ + { + "id": "", + "medicationId": "", + "userId": "", + "pausedAt": "", + "resumedAt": "", + "createdAt": "" + } + ], + "courses": [ + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-08-01T00:00:00.000Z", + "endsOn": "2026-08-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-01T00:00:00.000Z", + "endsOn": "2026-12-31T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + }, + { + "id": "", + "medicationId": "", + "userId": "", + "startsOn": "2026-10-20T00:00:00.000Z", + "endsOn": "2026-10-20T00:00:00.000Z", + "noteEncrypted": null, + "createdAt": "", + "updatedAt": "" + } + ], + "intakes": [ + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-10T07:00:00.000Z", + "takenAt": "2026-10-10T07:05:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-14T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T06:00:00.000Z", + "takenAt": "2026-10-15T06:10:00.000Z", + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": null + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-15T18:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T05:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + }, + { + "id": "", + "userId": "", + "medicationId": "", + "scheduledFor": "2026-10-16T06:00:00.000Z", + "takenAt": null, + "skipped": false, + "autoMissed": false, + "autoRecorded": false, + "attributionSource": "AUTO", + "source": "WEB", + "idempotencyKey": null, + "createdAt": "", + "injectionSite": null, + "doseTaken": null, + "inventoryConsumption": null, + "externalId": null, + "updatedAt": "", + "syncVersion": "", + "deletedAt": "" + } + ], + "doseChanges": [], + "inventoryItems": [ + { + "id": "", + "userId": "", + "medicationId": "", + "state": "ACTIVE", + "containerType": "OTHER", + "unitsTotal": "4", + "unitsRemaining": "3", + "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": [ + { + "medicationId": "", + "category": "OTHER", + "updatedAt": "" + }, + { + "medicationId": "", + "category": "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13", + "updatedAt": "" + } + ], + "ingredients": [ + { + "id": "", + "userId": "", + "medicationId": "", + "nutrient": "vitamin_d", + "amountPerUnit": 25, + "unit": "ug", + "enteredAmount": 1000, + "enteredUnit": "IU", + "source": "MANUAL", + "createdAt": "", + "updatedAt": "" + } + ], + "audit": [ + { + "action": "medication.delete", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "name": "To delete" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": "", + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Daily tablet renamed" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "active" + ], + "previous": { + "active": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": false + }, + "replacedCadence": "08:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "asNeeded" + ], + "previous": { + "asNeeded": true + }, + "replacedCadence": null, + "replacedScheduleCount": 0, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "autoMarkTaken" + ], + "previous": { + "autoMarkTaken": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "dose", + "name" + ], + "previous": { + "name": "Daily tablet", + "dose": "10mg" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + }, + "replacedCadence": "09:00 FREQ=DAILY", + "replacedScheduleCount": 1, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "endsOn" + ], + "previous": { + "endsOn": null + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "name" + ], + "previous": { + "name": "Record only" + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": false + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [ + "trackIntake" + ], + "previous": { + "trackIntake": true + } + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "08:00 FREQ=DAILY | 20:00 FREQ=DAILY", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 2, + "tombstonedFrom": "2026-10-15T18:00:00.000Z", + "tombstonedTo": "2026-10-16T06:00:00.000Z" + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {}, + "replacedCadence": "11:30 FREQ=DAILY | 20:00 i2;1,3,5", + "replacedScheduleCount": 2, + "tombstonedSlotCount": 0, + "tombstonedFrom": null, + "tombstonedTo": null + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + }, + { + "action": "medication.update", + "userId": "", + "actorUserId": null, + "details": { + "medicationId": "", + "fields": [], + "previous": {} + }, + "ipAddress": null + } + ], + "idempotency": [] + }, + "extra": [ + { + "name": "kit-ingest", + "permissions": [ + "medication::ingest" + ], + "revoked": true + }, + { + "name": "kit-phone", + "permissions": [ + "*" + ], + "revoked": false + } + ] +} diff --git a/tests/integration/routes/parity/medication-detail.parity.test.ts b/tests/integration/routes/parity/medication-detail.parity.test.ts new file mode 100644 index 000000000..64b13ac07 --- /dev/null +++ b/tests/integration/routes/parity/medication-detail.parity.test.ts @@ -0,0 +1,579 @@ +/** + * Parity for `GET`, `PUT` and `DELETE /api/medications/{id}` while the read, + * the edit and the delete 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: a rolling injection + * with stock, a composition, a custom category and automatic recording; a + * daily tablet without stock; a record-only medication; another account's + * medication; a reading delegate and nobody. The edits: plain fields, a + * schedule replace that moves the dose times outside the stale window (era + * archived, open slots tombstoned), the same schedule echoed back, the + * top-level reminder-window bridge, a pause and a resume, automatic recording + * switched on, the category writes (a custom one, a native client's OTHER over + * it, the web's OTHER, an unknown one), the record-only rule and both tracking + * transitions, the as-needed flips and their refusals, the one-shot refusals + * and a conversion, the course refusals and a course edit, a units change on + * a medication with a composition, a body the schema refuses, the not-found + * answer, a delegate who may write and one who may manage, and nobody. The + * deletes: the owner's (its scoped ingest token revoked), the not-found + * answer, a managing delegate 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 { DELETE, GET, PUT } from "@/app/api/medications/[id]/route"; +import { encryptToBytes } from "@/lib/ai/coach/bytes-codec"; + +import { anonymous, type RouteAuth } from "../../../kit/call-route"; +import { + makeMedication, + makeSession, + makeToken, + 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 supplement recompute the route hands a composition change to, recorded +// instead of run (see `effectRecorder`). +vi.mock( + "@/lib/medications/ingredients/recompute-job", + async (importOriginal) => { + const actual = + await importOriginal< + typeof import("@/lib/medications/ingredients/recompute-job") + >(); + const { effectRecorder } = await import("../../../kit/parity"); + return { + ...actual, + enqueueSupplementNutrientRecompute: async (...args: unknown[]) => { + effectRecorder.record("enqueueSupplementNutrientRecompute", args); + return { queued: true }; + }, + }; + }, +); + +const prisma = getPrismaClient(); +const NOW = new Date("2026-10-15T12:00:00.000Z"); +const ROUTE = "/api/medications/{id}"; +/** + * The edit answers without the read-model fields (reminder state, stock and + * runway, composition, links) the registered medication resource declares. + * The parity snapshot pins that answer as it is; the contract check is the + * route's own tests' business. + */ +const EDIT_ANSWER = { + skip: "the edit answers without the read-model fields of the resource", +}; +const CUSTOM_KEY = "custom:5b1f7c2e-4d3a-4b8e-9c61-2a7d0e9f4c13"; + +let ownerId: string; +let userIds: string[]; +let owner: RouteAuth; +let ownerBearer: RouteAuth; +let writer: { auth: RouteAuth; headers: Record }; +let reader: { auth: RouteAuth; headers: Record }; +let manager: { auth: RouteAuth; headers: Record }; +const med: Record = {}; + +type Caller = { auth?: RouteAuth; headers?: Record }; + +async function get(name: string, id: string, caller: Caller = {}) { + await parityStep({ + name: `medication-detail.${name}`, + handler: GET, + options: { + method: "GET", + route: ROUTE, + params: { id }, + auth: caller.auth ?? owner, + headers: caller.headers, + }, + userIds, + now: NOW, + }); +} + +async function put( + name: string, + id: string, + body: unknown, + caller: Caller = {}, +) { + await parityStep({ + name: `medication-detail.${name}`, + handler: PUT, + options: { + method: "PUT", + route: ROUTE, + params: { id }, + body, + auth: caller.auth ?? owner, + headers: caller.headers, + contract: EDIT_ANSWER, + }, + userIds, + now: NOW, + }); +} + +async function del(name: string, id: string, caller: Caller = {}) { + await parityStep({ + name: `medication-detail.${name}`, + handler: DELETE, + options: { + method: "DELETE", + route: ROUTE, + params: { id }, + auth: caller.auth ?? owner, + headers: caller.headers, + }, + userIds, + now: NOW, + // The ingest scope names the medication's generated id inside a string, + // which the id placeholders cannot see; it reads as the fixture's name. + extra: async () => + ( + await prisma.apiToken.findMany({ + where: { userId: ownerId }, + select: { name: true, permissions: true, revoked: true }, + orderBy: { name: "asc" }, + }) + ).map((token) => ({ + ...token, + permissions: token.permissions.map((p) => + p.replace(med.doomed, ""), + ), + })), + }); +} + +async function intake( + medicationId: string, + scheduledFor: string, + takenAt: string | null = null, +) { + await prisma.medicationIntakeEvent.create({ + data: { + userId: ownerId, + medicationId, + scheduledFor: new Date(scheduledFor), + takenAt: takenAt ? new Date(takenAt) : null, + createdAt: new Date("2026-10-01T06:00:00.000Z"), + }, + }); +} + +const daily = (windowStart: string, windowEnd: string, extra = {}) => ({ + windowStart, + windowEnd, + timesOfDay: [windowStart], + rrule: "FREQ=DAILY", + ...extra, +}); + +beforeAll(async () => { + vi.useFakeTimers({ toFake: ["Date"], now: NOW }); + await truncateAllTables(prisma); + const user = await makeUser({ timezone: "Europe/Berlin", locale: "en" }); + ownerId = user.id; + owner = await makeSession(user); + ownerBearer = await makeToken(user, { name: "kit-phone" }); + const created = new Date("2026-10-01T06:00:00.000Z"); + + const rolling = await makeMedication( + user, + { + name: "Rolling pen", + dose: "1 pen", + deliveryForm: "INJECTION", + unitsPerDose: 1, + startsOn: new Date("2026-10-01"), + createdAt: created, + autoMarkTaken: true, + autoMarkTakenSince: created, + }, + [ + { + windowStart: "09:00", + windowEnd: "11:00", + timesOfDay: ["09:00"], + rollingIntervalDays: 7, + }, + ], + ); + med.rolling = rolling.id; + await intake( + rolling.id, + "2026-10-10T07:00:00.000Z", + "2026-10-10T07:05:00.000Z", + ); + await prisma.medicationInventoryItem.create({ + data: { + userId: ownerId, + medicationId: rolling.id, + unitsTotal: 4, + unitsRemaining: 3, + purchasedAt: created, + }, + }); + await prisma.medicationIngredient.create({ + data: { + userId: ownerId, + medicationId: rolling.id, + nutrient: "vitamin_d", + amountPerUnit: 25, + unit: "ug", + enteredAmount: 1000, + enteredUnit: "IU", + source: "MANUAL", + }, + }); + await prisma.medicationCategoryLabel.create({ + data: { + userId: ownerId, + key: CUSTOM_KEY, + labelEncrypted: encryptToBytes("Heart and circulation"), + }, + }); + await prisma.medicationCategoryAssignment.create({ + data: { medicationId: rolling.id, category: CUSTOM_KEY }, + }); + + const tablet = await makeMedication( + user, + { + name: "Daily tablet", + startsOn: new Date("2026-10-01"), + createdAt: created, + }, + [daily("08:00", "10:00"), daily("20:00", "22:00")], + ); + med.tablet = tablet.id; + await intake(tablet.id, "2026-10-14T18:00:00.000Z"); + await intake( + tablet.id, + "2026-10-15T06:00:00.000Z", + "2026-10-15T06:10:00.000Z", + ); + await intake(tablet.id, "2026-10-15T18:00:00.000Z"); + await intake(tablet.id, "2026-10-16T06:00:00.000Z"); + + const recordOnly = await makeMedication( + user, + { + name: "Record only", + startsOn: new Date("2026-10-01"), + createdAt: created, + trackIntake: false, + }, + [daily("07:00", "08:00")], + ); + med.recordOnly = recordOnly.id; + await intake(recordOnly.id, "2026-10-16T05:00:00.000Z"); + + const asNeeded = await makeMedication( + user, + { name: "As needed", createdAt: created, asNeeded: true }, + [], + ); + med.asNeeded = asNeeded.id; + + const booster = await makeMedication( + user, + { name: "Booster", createdAt: created }, + [daily("09:00", "10:00")], + ); + med.booster = booster.id; + + const course = await makeMedication( + user, + { + name: "Course tablet", + startsOn: new Date("2026-10-01"), + createdAt: new Date("2026-07-25T06:00:00.000Z"), + }, + [daily("08:00", "09:00")], + ); + med.course = course.id; + await prisma.medicationCourse.createMany({ + data: [ + { + userId: ownerId, + medicationId: course.id, + startsOn: new Date("2026-08-01"), + endsOn: new Date("2026-08-31"), + }, + { + userId: ownerId, + medicationId: course.id, + startsOn: new Date("2026-10-01"), + endsOn: null, + }, + ], + }); + + const doomed = await makeMedication( + user, + { name: "To delete", createdAt: created }, + [daily("12:00", "13:00")], + ); + med.doomed = doomed.id; + await prisma.medicationIngredient.create({ + data: { + userId: ownerId, + medicationId: doomed.id, + nutrient: "magnesium", + amountPerUnit: 100, + unit: "mg", + source: "MANUAL", + }, + }); + await makeToken(user, { + name: "kit-ingest", + permissions: [`medication:${doomed.id}:ingest`], + }); + + const stranger = await makeUser({ timezone: "UTC" }); + const foreign = await makeMedication(stranger, { name: "Not yours" }); + med.foreign = foreign.id; + + const w = await delegateOf(prisma, user, "WRITE"); + const r = await delegateOf(prisma, user, "READ"); + const m = await delegateOf(prisma, user, "MANAGE"); + writer = { auth: w.auth, headers: w.headers }; + reader = { auth: r.auth, headers: r.headers }; + manager = { auth: m.auth, headers: m.headers }; + userIds = [ownerId, w.delegate.id, r.delegate.id, m.delegate.id]; +}); + +afterAll(() => { + vi.useRealTimers(); +}); + +describe("GET /api/medications/{id} parity", () => { + it("01 a rolling injection with stock, a composition and a custom category", async () => { + await get("01-rolling", med.rolling); + }); + + it("02 a daily tablet without stock", async () => { + await get("02-daily", med.tablet); + }); + + it("03 a record-only medication", async () => { + await get("03-record-only", med.recordOnly); + }); + + it("04 another account's medication", async () => { + await get("04-not-found", med.foreign); + }); + + it("05 a reading delegate, and nobody", async () => { + await get("05a-reader", med.rolling, reader); + await get("05b-anonymous", med.rolling, { auth: anonymous }); + }); +}); + +describe("PUT /api/medications/{id} parity", () => { + it("11 plain fields", async () => { + await put("11-plain-fields", med.tablet, { + name: "Daily tablet renamed", + dose: "20mg", + treatmentClass: "GENERIC", + dosesPerUnit: 30, + reorderLeadDays: 5, + deliveryForm: "ORAL", + notificationsEnabled: false, + liveActivityEnabled: true, + criticalAlarmEnabled: true, + atcCode: "C09AA05", + rxNormCode: null, + }); + }); + + it("12 a schedule replace whose dose time leaves the stale window", async () => { + await put("12-schedule-replace", med.tablet, { + schedules: [ + { + windowStart: "08:00", + windowEnd: "10:00", + timesOfDay: ["11:30"], + label: "Late morning", + dose: "10mg", + unitsPerDose: 2, + reminderGraceMinutes: 30, + }, + { + windowStart: "20:00", + windowEnd: "22:00", + daysOfWeek: [1, 3, 5], + intervalWeeks: 2, + doseWindows: [{ timeOfDay: "20:00", start: "19:30", end: "21:00" }], + }, + ], + }); + }); + + it("13 the same schedule echoed back", async () => { + await put("13-schedule-echo", med.tablet, { + schedules: [ + { + windowStart: "11:30", + windowEnd: "11:30", + timesOfDay: ["11:30"], + label: "Late morning", + dose: "10mg", + unitsPerDose: 2, + reminderGraceMinutes: 30, + rrule: "FREQ=DAILY", + }, + { + windowStart: "20:00", + windowEnd: "22:00", + daysOfWeek: [1, 3, 5], + intervalWeeks: 2, + doseWindows: [{ timeOfDay: "20:00", start: "19:30", end: "21:00" }], + }, + ], + }); + }); + + it("14 the top-level reminder window", async () => { + await put("14-grace-bridge", med.tablet, { reminderGraceMinutes: 45 }); + }); + + it("15 a pause and a resume", async () => { + await put("15a-pause", med.tablet, { active: false }); + await put("15b-resume", med.tablet, { active: true }); + }); + + it("16 automatic recording switched on", async () => { + await put("16-auto-mark-taken", med.tablet, { autoMarkTaken: true }); + }); + + it("17 the category writes", async () => { + await put("17a-custom-category", med.tablet, { category: CUSTOM_KEY }); + await put( + "17b-native-other-kept", + med.tablet, + { category: "OTHER" }, + { auth: ownerBearer }, + ); + await put("17c-web-other", med.tablet, { category: "OTHER" }); + await put("17d-unknown-category", med.tablet, { + category: "custom:0a6c2d4e-1111-4222-8333-944455556666", + }); + }); + + it("18 a record-only medication and both tracking transitions", async () => { + await put("18a-record-schedule-kept", med.recordOnly, { + name: "Record only renamed", + schedules: [daily("06:00", "07:00")], + oneShot: false, + }); + await put("18b-tracking-on", med.recordOnly, { trackIntake: true }); + await put("18c-tracking-off", med.recordOnly, { trackIntake: false }); + }); + + it("19 the as-needed flips and their refusals", async () => { + await put("19a-scheduled-without-schedules", med.asNeeded, { + asNeeded: false, + }); + await put("19b-scheduled", med.asNeeded, { + asNeeded: false, + schedules: [daily("08:00", "09:00")], + }); + await put("19c-as-needed-keeping-schedules", med.asNeeded, { + asNeeded: true, + }); + await put("19d-as-needed", med.asNeeded, { + asNeeded: true, + schedules: [], + }); + }); + + it("20 the one-shot refusals and a conversion", async () => { + await put("20a-one-shot-two-schedules", med.booster, { + oneShot: true, + startsOn: "2026-10-20", + schedules: [daily("09:00", "10:00"), daily("18:00", "19:00")], + }); + await put("20b-one-shot-recurrence", med.booster, { + oneShot: true, + startsOn: "2026-10-20", + schedules: [ + { windowStart: "09:00", windowEnd: "10:00", rrule: "FREQ=DAILY" }, + ], + }); + await put("20c-one-shot", med.booster, { + oneShot: true, + startsOn: "2026-10-20", + schedules: [{ windowStart: "09:00", windowEnd: "10:00" }], + }); + }); + + it("21 the course refusals and a course edit", async () => { + await put("21a-course-overlap", med.course, { startsOn: "2026-08-20" }); + await put("21b-course-window-required", med.course, { + startsOn: null, + endsOn: null, + }); + await put("21c-course-end", med.course, { endsOn: "2026-12-31" }); + }); + + it("22 a units change on a medication with a composition", async () => { + await put("22-composition-units", med.rolling, { unitsPerDose: 2 }); + }); + + it("23 a body the schema refuses, and another account's medication", async () => { + await put("23a-invalid", med.tablet, { + name: "", + unitsPerDose: -1, + schedules: "daily", + }); + await put("23b-not-found", med.foreign, { name: "Taken over" }); + }); + + it("24 a delegate who may write, one who may manage, and nobody", async () => { + await put("24a-writer", med.tablet, { name: "By a writer" }, writer); + await put("24b-manager", med.tablet, { name: "By a manager" }, manager); + await put( + "24c-anonymous", + med.tablet, + { name: "By nobody" }, + { auth: anonymous }, + ); + }); +}); + +describe("DELETE /api/medications/{id} parity", () => { + it("31 the owner deletes a medication with a composition and an ingest token", async () => { + await del("31-delete", med.doomed); + }); + + it("32 the same medication again", async () => { + await del("32-not-found", med.doomed); + }); + + it("33 a managing delegate, and nobody", async () => { + await del("33a-manager", med.booster, manager); + await del("33b-anonymous", med.booster, { auth: anonymous }); + }); +}); diff --git a/tests/integration/routes/parity/medication-state.ts b/tests/integration/routes/parity/medication-state.ts index b73829783..65703ed55 100644 --- a/tests/integration/routes/parity/medication-state.ts +++ b/tests/integration/routes/parity/medication-state.ts @@ -210,6 +210,14 @@ export interface ParityCall { userIds: string[]; /** The clock the test pinned; server stamps at or after it read ``. */ now: Date; + /** + * Waits, after the response, for a write the route deliberately does not + * await (a refusal's audit row), so the rows read back do not depend on + * whether it landed first. + */ + settle?: () => Promise; + /** Further state the route writes outside the medication tables. */ + extra?: () => Promise; } /** @@ -224,6 +232,7 @@ export async function parityStep(call: ParityCall) { const res = await callRoute(call.handler, call.options); const events = wideEventRecorder.take(); expect(events.length).toBeGreaterThan(0); + if (call.settle) await call.settle(); await expectParity( call.name, stable( @@ -233,6 +242,7 @@ export async function parityStep(call: ParityCall) { events: events.map(eventFacts).map(withoutCacheKeyHashes), effects: effectRecorder.take(), stored: await medicationState(getPrismaClient(), call.userIds), + ...(call.extra ? { extra: await call.extra() } : {}), }, { since: call.now }, ),