feat(backend): add events rules/indexes and messages timestamp overrides - #63
Merged
Merged
Conversation
Backend counterpart to the calendar (#42) and chat search (#43) features, which merged without it. Without these, the catch-all deny at the end of firestore.rules blocks every /events read, and the calendar's date+startTime query has no composite index to run against. - events: signed-in read, writes stay server-side only - events index on (date ASC, startTime ASC) for the calendar query - messages.timestamp fieldOverrides incl. COLLECTION_GROUP DESCENDING, required by chat search's collection-group query - referrals index on (isDeleted ASC, dateSubmitted DESC) These rules are already deployed to Firebase; this commit brings the repo in line with the deployed state. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Backend counterpart to the calendar (#42) and chat search (#43) features, which merged without it.
Why this is needed
firestore.rulesends with a catch-allmatch /{document=**} { allow read, write: if false; }. With no/eventsrule, every calendar read is denied — #42 is non-functional without this. Likewise the calendar'sdate+startTimequery and chat search's collection-group query onmessages.timestamphave no matching index to run against.Changes
eventsrule — signed-in read; create/update/delete stayfalse(writes are server-side only, matching the pattern used by neighboring collections).eventsindex on (dateASC,startTimeASC) — the calendar's ordered date query.messages.timestampfieldOverrides incl.COLLECTION_GROUP/DESCENDING— required by chat search's collection-group query.referralsindex on (isDeletedASC,dateSubmittedDESC).web/.gitignore— ignore the Vite cache dir, which was showing up as untracked.Notes
These rules are already deployed to Firebase; this PR brings the repo in line with the deployed state rather than introducing a new change to production.
No conflict with #61 — that PR edits the helper/
users/patientsregions offirestore.rules; this adds aneventsblock those hunks don't touch.🤖 Generated with Claude Code