Skip to content

fix(api): allow omitting dates when loading schedule slots - #1886

Merged
JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan
Nov 9, 2026
Merged

JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan

Conversation

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@JohnVillalovos
JohnVillalovos merged commit e91b592 into develop Nov 9, 2026
19 checks passed
@JohnVillalovos
JohnVillalovos deleted the jlvillal/phpstan branch November 9, 2026 22:51
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.

2 participants