mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +08:00
+translation +argType.Range
This commit is contained in:
1 parent
3cb4d2ad49
commit
b472b5c245
19 files changed
+100
-44
No files matched your search
@@ -23,7 +23,7 @@ import * as bus from '../service/bus';
|
||||
const ContestHandler = contest.ContestHandlerMixin(Handler);
|
||||
|
||||
class ContestListHandler extends ContestHandler {
|
||||
@param('rule', Types.String, true)
|
||||
@param('rule', Types.Range(contest.RULES), true)
|
||||
@param('page', Types.PositiveInt, true)
|
||||
async get(domainId: string, rule = '', page = 1) {
|
||||
this.response.template = 'contest_main.html';
|
||||
@@ -34,7 +34,6 @@ class ContestListHandler extends ContestHandler {
|
||||
tdocs = contest.getMulti(domainId).sort({ beginAt: -1 });
|
||||
qs = '';
|
||||
} else {
|
||||
if (!contest.RULES[rule]) throw new ValidationError('rule');
|
||||
tdocs = contest.getMulti(domainId, { rule }).sort({ beginAt: -1 });
|
||||
qs = `rule=${rule}`;
|
||||
}
|
||||
@@ -196,7 +195,7 @@ class ContestEditHandler extends ContestHandler {
|
||||
@param('duration', Types.Float)
|
||||
@param('title', Types.String, isTitle)
|
||||
@param('content', Types.String, isContent)
|
||||
@param('rule', Types.String)
|
||||
@param('rule', Types.Range(contest.RULES))
|
||||
@param('pids', Types.String)
|
||||
@param('rated', Types.Boolean)
|
||||
async post(
|
||||
|
||||
@@ -207,7 +207,7 @@ class DomainJoinApplicationsHandler extends ManageHandler {
|
||||
this.response.template = 'domain_join_applications.html';
|
||||
}
|
||||
|
||||
@param('method', Types.UnsignedInt)
|
||||
@param('method', Types.Range(domain.JOIN_METHOD_RANGE))
|
||||
@param('role', Types.String, true)
|
||||
@param('expire', Types.UnsignedInt, true)
|
||||
@param('invitationCode', Types.String, true)
|
||||
@@ -215,7 +215,6 @@ class DomainJoinApplicationsHandler extends ManageHandler {
|
||||
const r = await domain.getRoles(this.domain);
|
||||
const roles = r.map((rl) => rl._id);
|
||||
const current = domain.getJoinSettings(this.domain, roles);
|
||||
if (!domain.JOIN_METHOD_RANGE[method]) throw new ValidationError('method');
|
||||
let joinSettings;
|
||||
if (method === domain.JOIN_METHOD_NONE) joinSettings = null;
|
||||
else {
|
||||
@@ -245,7 +244,6 @@ class DomainJoinHandler extends Handler {
|
||||
if (this.user.role !== 'default') throw new DomainJoinAlreadyMemberError(this.domain._id, this.user._id);
|
||||
}
|
||||
|
||||
// @base.require_priv(builtin.PRIV_USER_PROFILE)
|
||||
@param('code', Types.String, true)
|
||||
async get(domainId: string, code: string) {
|
||||
this.response.template = 'domain_join.html';
|
||||
|
||||
Reference in new issue
Block a user