- Implemented API endpoints to fetch attendee details and statistics. - Created new route for fetching attendee by ID and their attendance stats. - Added schemas for attendee statistics. - Developed frontend components to display attendee details and attendance statistics. - Integrated attendee detail provider to manage state and data fetching. - Added tests for attendee retrieval and statistics calculation.
21 lines
628 B
TypeScript
21 lines
628 B
TypeScript
import { Hono } from 'hono';
|
|
import { problemJson, resultJson, unauthorizedProblem } from '@/http/problem-details';
|
|
import { GetAttendeeStats } from './use-case';
|
|
|
|
const route = new Hono();
|
|
|
|
route.get('/:groupId/attendees/:attendeeId/stats', async (c) => {
|
|
const user = c.get('user');
|
|
if (!user) {
|
|
return problemJson(c, unauthorizedProblem(c.req.path));
|
|
}
|
|
const groupId = c.req.param('groupId');
|
|
const attendeeId = c.req.param('attendeeId');
|
|
const useCase = new GetAttendeeStats();
|
|
const result = await useCase.execute(groupId, attendeeId, user.id);
|
|
|
|
return resultJson(c, result);
|
|
});
|
|
|
|
export default route;
|