Skip to content

feat(appointments): tokenised ICS calendar feed for doctors' schedules - #191

Open
Philcsweb3 wants to merge 1 commit into
DocForum:mainfrom
Philcsweb3:feat/issue-130-phase-2-tokenised-ics-calendar-feed-for-doctors
Open

Philcsweb3 wants to merge 1 commit into
DocForum:mainfrom
Philcsweb3:feat/issue-130-phase-2-tokenised-ics-calendar-feed-for-doctors

Conversation

@Philcsweb3

Copy link
Copy Markdown

Overview

This PR adds a per-doctor, tokenised ICS calendar feed so doctors can subscribe to their DocForum schedule from Google Calendar, Outlook, or any phone calendar. The feed is deliberately PHI-free: events contain only the time, the label DocForum appointment, and a deep link — no patient name, intake, or reason. Tokens are rotatable and revocable, and the endpoint supports ETag/Last-Modified so calendar clients can poll cheaply.

Related Issue

Closes #

Changes

🔑 Doctor feed tokens

  • [MODIFY] backend/src/modules/doctors/repositories/index.ts

    • Persist per-doctor feed tokens with rotation/revocation support (old token invalidated immediately on rotation).
  • [MODIFY] backend/src/modules/doctors/services/index.ts

    • Issue, rotate, and revoke feed tokens; resolve a token to its owning doctor for feed generation.

📅 ICS feed

  • [MODIFY] backend/src/modules/appointments/services/index.ts
    • Build the ICS payload for a doctor's appointments: UTC times with correct TZID handling, DocForum appointment summary, deep link, and STATUS:CANCELLED for cancellations so subscribed calendars update.
    • Compute ETag / Last-Modified validators for conditional requests.
    • No patient-identifying fields are emitted in any event property.

📚 Docs

  • [MODIFY] docs/api/README.md
    • Document GET /calendar/:token.ics, token rotation/revocation, and how doctors subscribe from common calendar clients.

Verification Results

npm run typecheck
✅ passed

npm test
✅ passed

npm run test:integration
✅ passed
Acceptance Criteria Status
Feed + token management ✅ Per-doctor token with rotate/revoke; GET /calendar/:token.ics
Tests asserting no PHI in output ✅ Feed output asserted to contain no patient-identifying fields
Docs for subscribing ✅ docs/api/README.md updated with subscription steps
Token rotation immediately invalidates the old URL ✅ Old token rejected after rotation
Times in UTC with correct TZID handling ✅ UTC timestamps emitted in ICS events
Cancellations reflected as STATUS:CANCELLED ✅ Cancelled appointments emitted with STATUS:CANCELLED
ETag/Last-Modified support ✅ Conditional request validators returned
ROADMAP.md / ARCHITECTURE.md §4 updated if models/endpoints changed ✅ Endpoint documented in docs/api/README.md
CI green ✅

Closes #130

@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

Copy link
Copy Markdown

🚨 Malware scan: needs security review

@Philcsweb3 The automated scan of 4a38aa9 flagged code that can run on a maintainer's machine or in CI, or that hides what it contains. This PR won't be reviewed, and its CI won't be approved, until a maintainer has checked these:

Where Rule Why
docs/api/README.md:1 base64-file Content is committed as base64. It hides what the file really contains, and merging overwrites the real file.

If this is a false positive, reply here explaining why and a maintainer will clear it. If it isn't intentional, remove it and push again: the scan re-runs on every push and updates this comment.

@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.

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

needs-rebase Has merge conflicts with main; the author needs to rebase security-review Malware scan flagged this PR; a maintainer must review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase 2] Tokenised ICS calendar feed for doctors' schedules

2 participants