Implemented getVolunteersTable API function #80#82
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Pull request overview
This PR implements a new API function to fetch all volunteers with their associated cohorts and roles in a single query. The implementation follows established patterns in the codebase and includes comprehensive test coverage.
Changes:
- Added
getVolunteersTablefunction that uses nested Supabase queries to efficiently fetch volunteers with their related cohorts and roles - Comprehensive integration tests covering various scenarios including empty results, volunteers with/without relations, and multiple volunteers
- Export added to the API index file for public access
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/lib/api/getVolunteersTable.ts | New API function that fetches all volunteers with nested cohorts and roles, includes proper TypeScript typing and error handling |
| tests/lib/api/getVolunteersTable.test.ts | Comprehensive integration tests covering empty results, various relation configurations, and data structure verification |
| src/lib/api/index.ts | Added export for the new getVolunteersTable function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| VolunteerRoles: Array<{ Roles: RoleRow | null }>; | ||
| }; | ||
|
|
||
| export async function getVolunteersTable(): Promise<VolunteerTableEntry[]> { |
There was a problem hiding this comment.
The PR title and description refer to "getVolunteersTables" (plural "Tables"), but the actual function name is "getVolunteersTable" (singular "Table"). This creates a discrepancy between the PR metadata and the implementation.
b250fee to
74d3135
Compare
@jonathanqiao1's PR #80. Reopening it after an issue.
This pull request implements the API function getVolunteersTables, which fetches all volunteers along with their associated cohorts and roles.
New volunteer data fetching utility:
Added
getVolunteersTablefunction insrc/lib/api/getVolunteersTable.tsto fetch all volunteers with their related cohorts and roles in a single query, returning a flat, easy-to-use structure. The function includes detailed TypeScript types and error handling for improved reliability.Tests are written in tests\lib\api\getVolunteersTable.test.ts for this function