Skip to content

Commit ecd66ef

Browse files
committed
Frontend changes + API Clients
1 parent 84470d0 commit ecd66ef

File tree

8 files changed

+865
-3
lines changed

8 files changed

+865
-3
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* API Client for match endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface MatchCreateRequest {
8+
participantId: string;
9+
volunteerIds: string[];
10+
matchStatus?: string;
11+
}
12+
13+
export interface MatchResponse {
14+
id: number;
15+
participantId: string;
16+
volunteerId: string;
17+
matchStatus: string;
18+
chosenTimeBlockId?: number | null;
19+
createdAt: string;
20+
updatedAt?: string | null;
21+
}
22+
23+
export interface MatchCreateResponse {
24+
matches: MatchResponse[];
25+
}
26+
27+
export const matchAPIClient = {
28+
/**
29+
* Create matches between a participant and volunteers
30+
* @param request Match creation request
31+
* @returns Created matches
32+
*/
33+
createMatches: async (request: MatchCreateRequest): Promise<MatchCreateResponse> => {
34+
const response = await baseAPIClient.post<MatchCreateResponse>('/matches/', request);
35+
return response.data;
36+
},
37+
};
38+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* API Client for matching endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface AdminMatchCandidate {
8+
volunteerId: string;
9+
firstName: string | null;
10+
lastName: string | null;
11+
email: string;
12+
timezone: string | null;
13+
age: number | null;
14+
diagnosis: string | null;
15+
treatments: string[];
16+
experiences: string[];
17+
matchScore: number;
18+
}
19+
20+
export interface AdminMatchesResponse {
21+
matches: AdminMatchCandidate[];
22+
}
23+
24+
export const matchingAPIClient = {
25+
/**
26+
* Get potential volunteer matches for a participant (admin only)
27+
* @param participantId Participant user ID
28+
* @returns List of volunteer matches with full details and scores
29+
*/
30+
getAdminMatches: async (participantId: string): Promise<AdminMatchesResponse> => {
31+
const response = await baseAPIClient.get<AdminMatchesResponse>(`/matching/admin/${participantId}`);
32+
return response.data;
33+
},
34+
};
35+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* API Client for ranking endpoints
3+
*/
4+
5+
import baseAPIClient from './baseAPIClient';
6+
7+
export interface RankingPreference {
8+
kind: 'quality' | 'treatment' | 'experience';
9+
id: number;
10+
scope: 'self' | 'loved_one';
11+
rank: number;
12+
name: string;
13+
}
14+
15+
export const rankingAPIClient = {
16+
/**
17+
* Get ranking preferences for a user (admin only)
18+
* @param userId User ID
19+
* @param target Target role ('patient' or 'caregiver')
20+
* @returns List of ranking preferences
21+
*/
22+
getPreferences: async (userId: string, target: 'patient' | 'caregiver'): Promise<RankingPreference[]> => {
23+
const response = await baseAPIClient.get<RankingPreference[]>(`/ranking/preferences/${userId}`, {
24+
params: { target },
25+
});
26+
return response.data;
27+
},
28+
};
29+

frontend/src/APIClients/taskAPIClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface BackendTask {
1111
endDate: string | null; // ISO datetime string
1212
createdAt: string;
1313
updatedAt: string;
14+
description: string | null;
1415
}
1516

1617
export interface TaskListResponse {

0 commit comments

Comments
 (0)