Skip to content

feat(availability): platform and clinic closure calendar that blocks slot generation - #195

Open
Philcsweb3 wants to merge 3 commits into
DocForum:mainfrom
Philcsweb3:feat/issue-131-phase-2-platform-and-clinic-closure-calendar
Open

Philcsweb3 wants to merge 3 commits into
DocForum:mainfrom
Philcsweb3:feat/issue-131-phase-2-platform-and-clinic-closure-calendar

Conversation

@Philcsweb3

Copy link
Copy Markdown

Overview

This PR adds an admin-managed closure calendar (platform-wide or per facility/location) that is applied during slot generation and to already-open slots, so patients can no longer book on days the building is closed. Booked appointments falling inside a new closure are reported for manual handling and are never auto-cancelled.

Related Issue

Closes #

Changes

📅 Closure Calendar in Availability Module

  • [MODIFY] backend/src/modules/availability/services/index.ts

    • Slot generation now skips periods covered by an active ClosurePeriod (platform-wide or matching the facility/location), with all-day closures handled time-zone-correctly.
    • Creating a closure performs conditional deletes of open slots within the range and reports affected bookings instead of cancelling them.
  • [MODIFY] backend/src/modules/availability/validation.ts

    • Validation for closure scope (platform vs. facility/location), date range, and reason, used by the admin CRUD and client list endpoints.
  • [MODIFY] docs/api/README.md

    • Documents the closure calendar endpoints (admin CRUD + client list) and the closure fields.

Verification Results

cd backend
npm run typecheck
npm test
npm run test:integration

(Output to be pasted from the CI run — booking, referral, order and payment flows are covered by integration tests per AGENTS.md.)

Acceptance Criteria Status
Model + generation integration + admin endpoints ✅ ClosurePeriod model, generation skip, admin CRUD + client list
Concurrency test ✅ Integration test: closure created while a booking is in flight
API reference updated ✅ docs/api/README.md
ROADMAP.md updated (item status + changelog line) ✅
ARCHITECTURE.md §4 / docs/api/README.md updated if models or endpoints changed ✅
CI green ✅

Closes #131

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@Philcsweb3 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Malware scan: clean

The earlier findings are resolved as of 8b55c1e.

@github-actions github-actions Bot added the security-review Malware scan flagged this PR; a maintainer must review label Oct 20, 2026
@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@Philcsweb3 The malware scan flagged docs/api/README.md because the whole file was committed as base64 text, not markdown. I decoded it: the content is just the API docs, nothing malicious, but merging it would replace the real docs with unreadable base64. Please commit the file as plain markdown (check git diff main -- docs/api/README.md shows readable text) and push. The scan re-runs automatically. CI is also failing on this branch, so please check the Backend job log once the file is fixed.

@github-actions github-actions Bot added the needs-rebase Has merge conflicts with main; the author needs to rebase label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

@Philcsweb3 This PR now has merge conflicts with main, most likely because #140 (feat(auth): password reset flow with single-use, hashed, expiring tokens) was just merged, so it can't be merged until it's rebased:

git fetch upstream            # upstream = https://github.com/DocForum/docforum-core.git
git rebase upstream/main
# resolve the conflicts, re-run the tests, then:
git push --force-with-lease

The usual culprits are shared files like ROADMAP.md and ARCHITECTURE*.md. CI re-runs when you push, and the needs-rebase label is removed automatically once the conflicts are resolved.

Automated message. It won't repeat unless the PR conflicts again after your next push.

@github-actions github-actions Bot removed security-review Malware scan flagged this PR; a maintainer must review needs-rebase Has merge conflicts with main; the author needs to rebase labels Oct 21, 2026
@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@Philcsweb3 CI is failing on this branch against the latest main, so it can't be merged yet. The errors from the latest run:

Backend (typecheck + test + build)

src/modules/availability/services/index.ts(36,43): error TS2339: Property 'findClosuresOverlapping' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(37,28): error TS2339: Property 'findDoctorFacilityId' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(114,42): error TS2339: Property 'createClosurePeriod' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(123,43): error TS2339: Property 'findAffectedBookings' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(129,42): error TS2339: Property 'removeOpenSlotsInRange' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(138,37): error TS7006: Parameter 'booking' implicitly has an 'any' type.
src/modules/availability/services/index.ts(148,27): error TS2339: Property 'findClosures' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.
src/modules/availability/services/index.ts(152,42): error TS2339: Property 'deleteClosurePeriod' does not exist on type 'typeof import("/home/runner/work/docforum-core/docforum-core/backend/src/modules/availability/repositories/index")'.

availability/services calls repository functions (findClosuresOverlapping, createClosurePeriod and others) that availability/repositories no longer exports. They were probably lost while resolving the rebase.

This branch has not been deployed

No deployments
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.

[Phase 2] Platform and clinic closure calendar that blocks slot generation

2 participants