@Controller('parent-portal')
@UseGuards(JwtAuthGuard, ParentGuard)
export class ParentPortalController {
@Get('children')
async getChildren(@CurrentUser() user: User) {
return this.parentService.getLinkedChildren(user.id);
}
@Get('children/:studentId')
async getChildDetails(
@Param('studentId') studentId: string,
@CurrentUser() user: User,
) {
await this.parentService.verifyAccess(user.id, studentId);
return this.parentService.getChildDetails(studentId);
}
@Get('children/:studentId/attendance')
async getAttendance(
@Param('studentId') studentId: string,
@Query('month') month: number,
) {
return this.attendanceService.getStudentSummary(studentId, month);
}
@Get('children/:studentId/fee-summary')
async getFeeSummary(@Param('studentId') studentId: string) {
return this.feeService.getStudentSummary(studentId);
}
}