新增考试归档与恢复功能

This commit is contained in:
2026-07-24 16:18:35 +08:00
parent 4046e29e33
commit 3573351f59
7 changed files with 280 additions and 29 deletions

View File

@@ -71,6 +71,48 @@ export class ExamsController {
return result;
}
@Put(':id/archive')
@RequirePermission('exam:view')
async archive(
@Param('id', ParseIntPipe) id: number,
@Request() req: AuthenticatedRequest,
) {
const result = await this.service.archive(id, req.user.id, this.canManageAll(req));
const { ipAddress, userAgent } = extractRequestInfo(req);
await this.logService.log({
userId: req.user.id,
username: req.user.username,
module: '考试管理',
action: '归档考试',
targetId: id,
targetType: 'exam',
ipAddress,
userAgent,
});
return result;
}
@Put(':id/restore')
@RequirePermission('exam:view')
async restore(
@Param('id', ParseIntPipe) id: number,
@Request() req: AuthenticatedRequest,
) {
const result = await this.service.restore(id, req.user.id, this.canManageAll(req));
const { ipAddress, userAgent } = extractRequestInfo(req);
await this.logService.log({
userId: req.user.id,
username: req.user.username,
module: '考试管理',
action: '恢复考试',
targetId: id,
targetType: 'exam',
ipAddress,
userAgent,
});
return result;
}
@Put(':examId/scores/:scoreId')
@RequirePermission('exam:view')
async updateScore(
@@ -100,5 +142,4 @@ export class ExamsController {
});
return result;
}
}