- replaced validation library @adonisjs/validator with @vinejs/vine (performance)
Some checks failed
CI Pipeline / japa-tests (push) Failing after 56s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 56s
- npm updates
This commit is contained in:
parent
08c2edca3b
commit
ec17d79cf2
32 changed files with 1677 additions and 1670 deletions
|
@ -4,8 +4,8 @@ import Dataset from '#models/dataset';
|
|||
import Field from '#app/Library/Field';
|
||||
import BaseModel from '#models/base_model';
|
||||
import { DateTime } from 'luxon';
|
||||
import { schema, rules } from '@adonisjs/validator';
|
||||
import { ModelQueryBuilderContract } from "@adonisjs/lucid/types/model";
|
||||
import vine from '@vinejs/vine';
|
||||
|
||||
interface Dictionary {
|
||||
[index: string]: string;
|
||||
|
@ -227,13 +227,19 @@ export default class DatasetsController {
|
|||
})
|
||||
.firstOrFail();
|
||||
|
||||
const newSchema = schema.create({
|
||||
server_state: schema.string({ trim: true }),
|
||||
reject_reviewer_note: schema.string({ trim: true }, [rules.minLength(10), rules.maxLength(500)]),
|
||||
// const newSchema = schema.create({
|
||||
// server_state: schema.string({ trim: true }),
|
||||
// reject_reviewer_note: schema.string({ trim: true }, [rules.minLength(10), rules.maxLength(500)]),
|
||||
// });
|
||||
const newSchema = vine.object({
|
||||
server_state: vine.string().trim(),
|
||||
reject_reviewer_note: vine.string().trim().minLength(10).maxLength(500),
|
||||
});
|
||||
|
||||
try {
|
||||
await request.validate({ schema: newSchema });
|
||||
// await request.validate({ schema: newSchema });
|
||||
const validator = vine.compile(newSchema);
|
||||
await request.validateUsing(validator);
|
||||
} catch (error) {
|
||||
// return response.badRequest(error.messages);
|
||||
throw error;
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue