Feature/119 coordinator availability backend - #124
Open
Berny-ft wants to merge 4 commits into
Open
Conversation
…inator availability - Introduced Zod schemas for validating availability slots and weekly availability. - Implemented a function to check for overlapping slots within a day. - Added a new database table for storing coordinator availability with appropriate types and constraints.
…database structure - Added Zod schemas for validating weekly availability and updating coordinator availability. - Implemented a function to check for overlapping time slots within a day. - Updated the database schema to include a new structure for storing coordinator availability as JSON.
- Added a new function to update coordinator availability with validation using Zod schema. - Implemented role-based access control to ensure only authorized users can edit availability. - Enhanced database interactions to handle conflicts when updating coordinator availability records.
- Added tests to verify role-based access control for updating coordinator availability. - Implemented checks for unauthorized access for non-signed-in users and parents. - Ensured coordinators can only update their own slots and admins can update any coordinator's slots. - Added validation to reject overlapping time slots on the same day.
Berny-ft
requested review from
RenaudBernier and
martin0024
and
a lite review from Copilot
August 17, 2026 03:59
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.
Closes #119
Overview
Coordinators need a standing weekly availability template (hours they repeat each week) that only they can edit for themselves, while admins can edit any coordinator’s template and everyone else cannot.
This adds a
coordinator_availabilitytable (one row per coordinator, slots stored as a 7-day JSON object), Zod validation inapp/coaching/schema.ts(HH:MM times, duration, no overlapping slots on the same day), and aupdateCoordinatorAvailabilityserver action that upserts the week after those auth checks.Testing
Unit tests in
__tests__/coordinator-availability-actions.test.ts: unsigned-in and parent users are rejected, a coordinator can save only their own week, an admin can save another coordinator’s week, and overlapping same-day slots never hit the database. Ran the CI checks locally (pnpm lint,pnpm test:ci); 42 tests passed. Table was pushed withpnpm db:push. No UI in this ticket, so no manual UI pass.Checklist