- add model DatasetReference.ts
All checks were successful
CI Pipeline / japa-tests (push) Successful in 48s

- add references inside Creta.vue for Submitter /dataset
- npm updates
- extended enum types
- added relations for Dataset.ts
This commit is contained in:
Kaimbacher 2023-08-01 17:06:51 +02:00
parent 5ce4f0b018
commit f6d735d0fd
10 changed files with 580 additions and 592 deletions

View file

@ -1,7 +1,7 @@
import { schema, CustomMessages, rules } from '@ioc:Adonis/Core/Validator';
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
import dayjs from 'dayjs';
import { TitleTypes, DescriptionTypes } from 'Contracts/enums';
import { TitleTypes, DescriptionTypes, RelationTypes, ReferenceIdentifierTypes } from 'Contracts/enums';
export default class CreateDatasetValidator {
constructor(protected ctx: HttpContextContract) {}
@ -73,6 +73,17 @@ export default class CreateDatasetValidator {
depth_min: schema.number.optional([rules.requiredIfExists('depth_max')]),
depth_max: schema.number.optional([rules.requiredIfExists('depth_min')]),
}),
references: schema.array([rules.uniqueArray('value')]).members(
schema.object().members({
value: schema.string({ trim: true }, [
rules.minLength(3),
rules.maxLength(255),
]),
type: schema.enum(Object.values(ReferenceIdentifierTypes)),
relation: schema.enum(Object.values(RelationTypes)),
// language: schema.string({ trim: true }, [rules.minLength(2), rules.maxLength(255)]),
}),
),
subjects: schema.array([rules.minLength(3), rules.uniqueArray('value')]).members(
schema.object().members({
value: schema.string({ trim: true }, [