fix permissions and teacher attendance workflows

This commit is contained in:
2026-07-10 20:40:52 +08:00
parent 247879f276
commit 8ed1682b90
95 changed files with 4745 additions and 1237 deletions

View File

@@ -58,6 +58,33 @@ export class ClassroomRentalsController {
return this.service.getSchedule(y, m);
}
@Get('unavailable-dates')
@RequirePermission('rental:view')
getUnavailableDates(
@Query('classroomId') classroomId?: string,
@Query('year') year?: string,
@Query('month') month?: string,
@Query('excludeId') excludeId?: string,
) {
const parsedClassroomId = Number(classroomId);
const parsedYear = Number(year);
const parsedMonth = Number(month);
if (!Number.isInteger(parsedClassroomId) || parsedClassroomId <= 0) {
throw new BadRequestException('请选择有效教室');
}
if (!Number.isInteger(parsedYear) || parsedYear < 2000 || parsedYear > 2100) {
throw new BadRequestException('年份不合法');
}
if (!Number.isInteger(parsedMonth) || parsedMonth < 1 || parsedMonth > 12) {
throw new BadRequestException('月份必须在 1-12 之间');
}
const parsedExcludeId = excludeId === undefined ? undefined : Number(excludeId);
if (parsedExcludeId !== undefined && (!Number.isInteger(parsedExcludeId) || parsedExcludeId <= 0)) {
throw new BadRequestException('排除的租赁订单不合法');
}
return this.service.getUnavailableDates(parsedClassroomId, parsedYear, parsedMonth, parsedExcludeId);
}
@Get(':id')
@RequirePermission('rental:view')
findOne(@Param('id') id: string) {