Repository navigation
fix(api): allow omitting dates when loading schedule slots - #1886
Merged
Merged
Conversation
GET /Schedules/:scheduleId/Slots documents startDateTime and endDateTime as optional, falling back to the schedule's default dates. GetDate() returns null when a parameter is missing, but GetSlots() called ToTimezone() on the result unconditionally, so omitting either date failed with "Call to a member function ToTimezone() on null" and an HTTP 500. Use the nullsafe operator so missing dates reach the page builder, which already falls back to the default dates. Assisted-by: Claude:claude-opus-5-5
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the optional-date nullsafe handling is covered by regression tests for requests without date parameters.
No open issues 🎉
What changed in this PR
This pull request fixes GET /Schedules/:scheduleId/Slots so omitted date parameters no longer cause a null dereference or HTTP 500. Missing dates now reach the existing schedule-date fallback logic.
Changes:
- Use nullsafe
ToTimezone()calls for optional start and end dates. - Add regression coverage for requests without date parameters.
This pull request is ready to be approved.
| File | Description |
|---|---|
WebServices/SchedulesWebService.php |
Allows missing startDateTime and endDateTime values to reach schedule-date fallback handling. |
tests/WebServices/SchedulesWebServiceTest.php |
Adds regression coverage confirming slots requests without dates produce an application response. |
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GET /Schedules/:scheduleId/Slots documents startDateTime and endDateTime as optional, falling back to the schedule's default dates. GetDate() returns null when a parameter is missing, but GetSlots() called ToTimezone() on the result unconditionally, so omitting either date failed with "Call to a member function ToTimezone() on null" and an HTTP 500.
Use the nullsafe operator so missing dates reach the page builder, which already falls back to the default dates.
Assisted-by: Claude:claude-opus-5-5