mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: 支持删除training
This commit is contained in:
1 parent
33f84418b6
commit
584a0edca6
2 files changed
+9
-1
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.20.39",
|
||||
"version": "2.20.40",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -157,6 +157,14 @@ class TrainingDetailHandler extends Handler {
|
||||
await training.enroll(domainId, tdoc.docId, this.user._id);
|
||||
this.back();
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
async postDelete(domainId: string, tid: ObjectID) {
|
||||
const tdoc = await training.get(domainId, tid);
|
||||
if (tdoc.owner !== this.user._id) this.checkPerm(PERM.PERM_EDIT_TRAINING);
|
||||
await training.del(domainId, tid);
|
||||
this.response.redirect = this.url('training_main');
|
||||
}
|
||||
}
|
||||
|
||||
class TrainingCreateHandler extends Handler {
|
||||
|
||||
Reference in new issue
Block a user