mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: schemastery validator
This commit is contained in:
1 parent
2d4d99c80c
commit
1f113e7a08
17 files changed
+145
-136
No files matched your search
@@ -6,6 +6,7 @@ import mysql from 'mysql';
|
||||
import TurndownService from 'turndown';
|
||||
import { STATUS } from '@hydrooj/utils/lib/status';
|
||||
import { noop, Time } from '@hydrooj/utils/lib/utils';
|
||||
import { addScript, Schema } from 'hydrooj';
|
||||
import { NotFoundError } from 'hydrooj/src/error';
|
||||
import { postJudge } from 'hydrooj/src/handler/judge';
|
||||
import { RecordDoc } from 'hydrooj/src/interface';
|
||||
@@ -310,16 +311,14 @@ export async function run({
|
||||
return true;
|
||||
}
|
||||
|
||||
export const description = 'migrate from hustoj';
|
||||
export const validate = {
|
||||
host: 'string',
|
||||
port: 'number',
|
||||
name: 'string',
|
||||
username: 'string',
|
||||
password: 'string',
|
||||
domainId: 'string',
|
||||
contestType: 'string',
|
||||
dataDir: 'string',
|
||||
};
|
||||
|
||||
global.Hydro.script.migrateHustoj = { run, description, validate };
|
||||
addScript('migrateHustoj', 'mirate from hustoj')
|
||||
.args(Schema.object({
|
||||
host: Schema.string().required(),
|
||||
port: Schema.number().required(),
|
||||
name: Schema.string().required(),
|
||||
username: Schema.string().required(),
|
||||
password: Schema.string().required(),
|
||||
domainId: Schema.string().required(),
|
||||
contestType: Schema.string().required(),
|
||||
dataDir: Schema.string().required(),
|
||||
}));
|
||||
@@ -2,7 +2,8 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import mongodb, { Cursor, Db } from 'mongodb';
|
||||
import {
|
||||
DiscussionTailReplyDoc, MessageDoc, RecordDoc, TestCase, TrainingNode,
|
||||
addScript, DiscussionTailReplyDoc, MessageDoc,
|
||||
RecordDoc, Schema, TestCase, TrainingNode,
|
||||
} from 'hydrooj';
|
||||
|
||||
const dst = global.Hydro.service.db;
|
||||
@@ -506,9 +507,11 @@ export async function run({
|
||||
return true;
|
||||
}
|
||||
|
||||
export const description = 'migrate from vijos';
|
||||
export const validate = {
|
||||
host: 'string', port: 'number', name: 'string', username: 'string', password: 'string',
|
||||
};
|
||||
|
||||
global.Hydro.script.migrateVijos = { run, description, validate };
|
||||
addScript('migrateVijos', 'mirate from vijos')
|
||||
.args(Schema.object({
|
||||
host: Schema.string().required(),
|
||||
port: Schema.number().required(),
|
||||
name: Schema.string().required(),
|
||||
username: Schema.string().required(),
|
||||
password: Schema.string().required(),
|
||||
}));
|
||||
Reference in new issue
Block a user