mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 17:38:19 +08:00
core: use Types.ArrayOf to replace Types.Array
This commit is contained in:
1 parent
760c585ac5
commit
37af6fd5a6
7 files changed
+9
-8
No files matched your search
@@ -557,7 +557,7 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
@post('files', Types.Array)
|
||||
@post('files', Types.ArrayOf(Types.Name))
|
||||
async postDeleteFiles(domainId: string, tid: ObjectID, files: string[]) {
|
||||
await Promise.all([
|
||||
storage.del(files.map((t) => `contest/${domainId}/${tid}/${t}`), this.user._id),
|
||||
|
||||
@@ -224,7 +224,7 @@ class DomainRoleHandler extends ManageHandler {
|
||||
}
|
||||
|
||||
@requireSudo
|
||||
@param('roles', Types.Array)
|
||||
@param('roles', Types.ArrayOf(Types.Name))
|
||||
async postDelete(domainId: string, roles: string[]) {
|
||||
if (Set.intersection(roles, ['root', 'default', 'guest']).size > 0) {
|
||||
throw new ValidationError('role', null, 'You cannot delete root, default or guest roles');
|
||||
|
||||
@@ -69,7 +69,7 @@ export class FilesHandler extends Handler {
|
||||
this.back();
|
||||
}
|
||||
|
||||
@post('files', Types.Array)
|
||||
@post('files', Types.ArrayOf(Types.Name))
|
||||
async postDeleteFiles(domainId: string, files: string[]) {
|
||||
await Promise.all([
|
||||
storage.del(files.map((t) => `user/${this.user._id}/${t}`), this.user._id),
|
||||
|
||||
@@ -784,7 +784,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
||||
this.back();
|
||||
}
|
||||
|
||||
@post('files', Types.Array)
|
||||
@post('files', Types.ArrayOf(Types.Name))
|
||||
@post('type', Types.Range(['testdata', 'additional_file']), true)
|
||||
async postDeleteFiles(domainId: string, files: string[], type = 'testdata') {
|
||||
if (this.pdoc.reference) throw new ProblemIsReferencedError('delete files');
|
||||
|
||||
@@ -279,7 +279,7 @@ export class TrainingFilesHandler extends Handler {
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
@post('files', Types.Array)
|
||||
@post('files', Types.ArrayOf(Types.Name))
|
||||
async postDeleteFiles(domainId: string, tid: ObjectID, files: string[]) {
|
||||
await Promise.all([
|
||||
storage.del(files.map((t) => `contest/${domainId}/${tid}/${t}`), this.user._id),
|
||||
|
||||
Reference in new issue
Block a user