core: admin can remove contestant before contest start (#1196)

This commit is contained in:
Baoshuo authored and GitHub committed 2026-08-03 12:42:33 +08:00
1 parent 52f811cf98
commit f29971a30d
11 files changed
+50 -3

No files matched your search

+12 -2
View File
@@ -10,8 +10,8 @@ import {
} from '@hydrooj/utils/lib/utils';
import { Context, Service } from '../context';
import {
BadRequestError, ContestNotAttendedError, ContestNotEndedError, ContestNotFoundError, ContestNotLiveError,
ContestScoreboardHiddenError, FileLimitExceededError, FileUploadError,
BadRequestError, ContestAlreadyStartedError, ContestNotAttendedError, ContestNotEndedError, ContestNotFoundError,
ContestNotLiveError, ContestScoreboardHiddenError, FileLimitExceededError, FileUploadError,
InvalidTokenError, MethodNotAllowedError, NotAssignedError, NotFoundError, PermissionError, ValidationError,
} from '../error';
import { ContestStatusDoc, FileInfo, ScoreboardConfig, Tdoc } from '../interface';
@@ -761,6 +761,16 @@ export class ContestUserHandler extends ContestManagementBaseHandler {
await contest.setStatus(domainId, tid, uid, null, { endAt: '' });
this.back();
}
@param('tid', Types.ObjectId)
@param('uid', Types.Int)
async postRemoveUser(domainId: string, tid: ObjectId, uid: number) {
if (!contest.isNotStarted(this.tdoc)) throw new ContestAlreadyStartedError();
const tsdoc = await contest.getStatus(domainId, tid, uid);
if (!tsdoc?.attend) throw new ContestNotAttendedError(uid);
await contest.cancelAttend(domainId, tid, uid);
this.back();
}
}
export class ContestBalloonHandler extends ContestManagementBaseHandler {