- Implemented AbsenceNotifyView for notifying absence with session details. - Created AnalyticsView for displaying group analytics and managing students at risk. - Added ClassAttendanceView for marking attendance in classes. - Defined new schemas for analytics and attendance in shared package.
25 lines
832 B
TypeScript
25 lines
832 B
TypeScript
import type { TodayClassesQuery } from '@gruperly/shared';
|
|
import { TodayClassesQuerySchema } from '@gruperly/shared';
|
|
import { Hono } from 'hono';
|
|
import { problemJson, resultJson, unauthorizedProblem } from '@/http/problem-details';
|
|
import { validate } from '@/http/validate';
|
|
import { GetSessionStudents } from './use-case';
|
|
|
|
const route = new Hono();
|
|
|
|
route.get('/:sessionId/students', validate.query(TodayClassesQuerySchema), async (c) => {
|
|
const user = c.get('user');
|
|
if (!user) {
|
|
return problemJson(c, unauthorizedProblem(c.req.path));
|
|
}
|
|
|
|
const sessionId = c.req.param('sessionId');
|
|
const query = c.req.valid('query') as TodayClassesQuery;
|
|
const useCase = new GetSessionStudents();
|
|
const result = await useCase.execute(sessionId, user.id, query);
|
|
|
|
return resultJson(c, result);
|
|
});
|
|
|
|
export default route;
|