Skip to content

fix: allow scheduled Apple Health medication mirrors - #1007

Open
muhdusama wants to merge 1 commit into
MBombeck:mainfrom
muhdusama:medfix/apple-health-scheduled-mirror
Open

muhdusama wants to merge 1 commit into
MBombeck:mainfrom
muhdusama:medfix/apple-health-scheduled-mirror

Conversation

@muhdusama

@muhdusama muhdusama commented Sep 19, 2026

Copy link
Copy Markdown

Summary

Allow Apple Health medication mirrors with asNeeded: false to be created without requiring a HealthLog-owned schedule.

The iOS client maps HealthKit medications that have an Apple schedule to asNeeded: false, but does not send HealthLog schedules. The server previously rejected those mirrors with HTTP 422 (Mindestens ein Zeitfenster).

This change exempts externalSource: APPLE_HEALTH from the local schedule requirement while preserving the existing validation for native HealthLog medications.

Tests

  • src/app/api/medications/__tests__/route.test.ts: 33/33 passed on current main
  • Added regression coverage for a scheduled Apple Health mirror without a HealthLog-owned schedule
  • End-to-end sync validation confirmed the previously rejected request shape now returns HTTP 201 and remains as_needed=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant