mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01: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
@@ -1,9 +1,8 @@
|
||||
{
|
||||
"name": "@hydrooj/sonic",
|
||||
"version": "1.2.6",
|
||||
"version": "1.2.7",
|
||||
"description": "Sonic search service",
|
||||
"main": "service.js",
|
||||
"typings": "service.d.ts",
|
||||
"main": "service.ts",
|
||||
"preferUnplugged": true,
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { addScript, Schema } from 'hydrooj';
|
||||
import DomainModel from 'hydrooj/src/model/domain';
|
||||
import { iterateAllProblem, iterateAllProblemInDomain } from 'hydrooj/src/pipelineUtils';
|
||||
import sonic from './service';
|
||||
|
||||
export const description = 'Sonic problem search re-index';
|
||||
|
||||
export async function run({ domainId }, report) {
|
||||
async function run({ domainId }, report) {
|
||||
if (domainId) await sonic.flushb('problem', domainId);
|
||||
else await sonic.flushc('problem');
|
||||
let i = 0;
|
||||
@@ -29,11 +28,8 @@ export async function run({ domainId }, report) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export const validate = {
|
||||
$or: [
|
||||
{ domainId: 'string' },
|
||||
{ domainId: 'undefined' },
|
||||
],
|
||||
};
|
||||
|
||||
global.Hydro.script.ensureSonicSearch = { run, description, validate };
|
||||
addScript('ensureSonicSearch', 'Sonic problem search re-index')
|
||||
.args(Schema.object({
|
||||
domainId: Schema.string(),
|
||||
}))
|
||||
.action(run);
|
||||
Reference in new issue
Block a user