- dark modus for geoera search (keywords)
All checks were successful
CI Pipeline / japa-tests (push) Successful in 50s

- enum ContributorTypes
- add contributor types for creating a dataset
- npm updates
- tailwind styling for _table.css
- adapting migration code for dataset_11_subject.ts
This commit is contained in:
Kaimbacher 2023-09-12 16:09:04 +02:00
parent 3ea2e8ca94
commit b1d587d9f5
9 changed files with 156 additions and 88 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, RelationTypes, ReferenceIdentifierTypes } from 'Contracts/enums';
import { TitleTypes, DescriptionTypes, RelationTypes, ReferenceIdentifierTypes, ContributorTypes } from 'Contracts/enums';
export default class CreateDatasetValidator {
constructor(protected ctx: HttpContextContract) {}
@ -58,6 +58,12 @@ export default class CreateDatasetValidator {
}),
),
authors: schema.array([rules.minLength(1)]).members(schema.object().members({ email: schema.string({ trim: true }) })),
contributors: schema.array.optional().members(
schema.object().members({
email: schema.string({ trim: true }),
pivot_contributor_type: schema.enum(Object.keys(ContributorTypes)),
}),
),
// third step
project_id: schema.number.optional(),
embargo_date: schema.date.optional({ format: 'yyyy-MM-dd' }, [rules.after(10, 'days')]),
@ -149,6 +155,7 @@ export default class CreateDatasetValidator {
'The language of the translated description must be different from the language of the dataset',
'authors.minLength': 'at least {{ options.minLength }} author must be defined',
'contributors.*.pivot_contributor_type.required': 'contributor type is required, if defined',
'after': `{{ field }} must be older than ${dayjs().add(10, 'day')}`,