mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: add training maintainer
This commit is contained in:
5 files changed
+18
-8
No files matched your search
@@ -206,20 +206,20 @@ class TrainingEditHandler extends Handler {
|
||||
@param('dag', Types.Content)
|
||||
@param('pin', Types.UnsignedInt)
|
||||
@param('description', Types.Content)
|
||||
@param('maintainer', Types.NumericArray, true)
|
||||
async post(
|
||||
domainId: string, tid: ObjectId,
|
||||
title: string, content: string,
|
||||
_dag: string, pin = 0, description: string,
|
||||
domainId: string, tid: ObjectId, title: string, content: string,
|
||||
_dag: string, pin = 0, description: string, maintainer: number[] = [],
|
||||
) {
|
||||
if ((!!this.tdoc?.pin) !== (!!pin)) this.checkPerm(PERM.PERM_PIN_TRAINING);
|
||||
const dag = await _parseDagJson(domainId, _dag);
|
||||
const pids = training.getPids(dag);
|
||||
assert(pids.length, new ValidationError('dag', null, 'Please specify at least one problem'));
|
||||
if (!tid) {
|
||||
tid = await training.add(domainId, title, content, this.user._id, dag, description, pin);
|
||||
tid = await training.add(domainId, title, content, this.user._id, dag, description, pin, maintainer);
|
||||
} else {
|
||||
await training.edit(domainId, tid, {
|
||||
title, content, dag, description, pin,
|
||||
title, content, dag, description, pin, maintainer,
|
||||
});
|
||||
}
|
||||
this.response.body = { tid };
|
||||
|
||||
@@ -35,8 +35,8 @@ export function setStatus(domainId: string, tid: ObjectId, uid: number, $set: an
|
||||
}
|
||||
|
||||
export function add(
|
||||
domainId: string, title: string, content: string,
|
||||
owner: number, dag: TrainingNode[] = [], description = '', pin = 0,
|
||||
domainId: string, title: string, content: string, owner: number,
|
||||
dag: TrainingNode[] = [], description = '', pin = 0, maintainer: number[] = [],
|
||||
) {
|
||||
return document.add(domainId, content, owner, document.TYPE_TRAINING, null, null, null, {
|
||||
dag,
|
||||
@@ -44,6 +44,7 @@ export function add(
|
||||
description,
|
||||
attend: 0,
|
||||
pin,
|
||||
maintainer,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user