Skip to content

Feature/119 coordinator availability backend - #124

Open
Berny-ft wants to merge 4 commits into
developfrom
feature/119-coordinator-availability-backend
Open

Feature/119 coordinator availability backend#124
Berny-ft wants to merge 4 commits into
developfrom
feature/119-coordinator-availability-backend

Conversation

@Berny-ft

@Berny-ft Berny-ft commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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_availability table (one row per coordinator, slots stored as a 7-day JSON object), Zod validation in app/coaching/schema.ts (HH:MM times, duration, no overlapping slots on the same day), and a updateCoordinatorAvailability server 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 with pnpm db:push. No UI in this ticket, so no manual UI pass.

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

…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
Berny-ft requested review from RenaudBernier and martin0024 and a lite review from Copilot August 17, 2026 03:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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