mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: admin can remove contestant before contest start (#1196)
This commit is contained in:
1 parent
52f811cf98
commit
f29971a30d
11 files changed
+50
-3
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user