Skip to content

Implemented getVolunteersTable API function #80#82

Merged
1zhaohel merged 3 commits intomainfrom
backend/get-volunteers-table-api
Feb 25, 2026
Merged

Implemented getVolunteersTable API function #80#82
1zhaohel merged 3 commits intomainfrom
backend/get-volunteers-table-api

Conversation

@LeandroHamaguchi
Copy link
Member

@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 getVolunteersTable function in src/lib/api/getVolunteersTable.ts to 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

@vercel
Copy link

vercel bot commented Jan 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
trcc Ignored Ignored Feb 25, 2026 8:53pm

@LeandroHamaguchi LeandroHamaguchi linked an issue Jan 24, 2026 that may be closed by this pull request
@LeandroHamaguchi LeandroHamaguchi changed the title Backend/get volunteers table api Implemented getVolunteersTable API function #80 Jan 24, 2026
@ch-iv ch-iv requested a review from Copilot January 27, 2026 17:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 getVolunteersTable function 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[]> {
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link

@whlpatricia whlpatricia left a comment

Choose a reason for hiding this comment

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

LGTM!

@1zhaohel 1zhaohel force-pushed the backend/get-volunteers-table-api branch from b250fee to 74d3135 Compare February 25, 2026 20:53
@1zhaohel 1zhaohel merged commit fd8e07b into main Feb 25, 2026
3 checks passed
@1zhaohel 1zhaohel deleted the backend/get-volunteers-table-api branch February 25, 2026 20:57
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.

BE 1.5 - Implement get_volunteers_table function

4 participants