feat: enhance user management, mimetype creation, and validation
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m8s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m8s
- **AdminuserController.ts**: enable editing `first_name` and `last_name` for user creation and updates - **MimetypeController.ts**: add creation support for mimetypes with selectable extensions - **Models**: add `Mimetype` model (mime_type.ts); add `SnakeCaseNamingStrategy` for User model - **Validators**: - **updateDatasetValidator**: increase title length to 255 and description length to 2500 - **User Validators**: refine `createUserValidator` and `updateUserValidator` to include `first_name` and `last_name` - **vanilla_error_reporter**: improve error reporting for wildcard fields - **SKOS Query**: refine keyword request in `SearchCategoryAutocomplete.vue` - **UI Enhancements**: - improve icon design in wizard (Wizard.vue) - add components for mimetype creation (Create.vue and button in Index.vue) - **Routes**: update `routes.ts` to include new AdonisJS routes
This commit is contained in:
parent
2235f3905a
commit
49bd96ee77
24 changed files with 1548 additions and 945 deletions
|
@ -13,6 +13,8 @@ export const createUserValidator = vine.compile(
|
|||
.maxLength(20)
|
||||
.isUnique({ table: 'accounts', column: 'login' })
|
||||
.regex(/^[a-zA-Z0-9]+$/), //Must be alphanumeric with hyphens or underscores
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
email: vine.string().maxLength(255).email().normalizeEmail().isUnique({ table: 'accounts', column: 'email' }),
|
||||
password: vine.string().confirmed().trim().minLength(3).maxLength(60),
|
||||
roles: vine.array(vine.number()).minLength(1), // define at least one role for the new user
|
||||
|
@ -30,8 +32,10 @@ export const updateUserValidator = vine.withMetaData<{ objId: number }>().compil
|
|||
.trim()
|
||||
.minLength(3)
|
||||
.maxLength(20)
|
||||
.isUnique({ table: 'accounts', column: 'login', whereNot: (field) => field.meta.objId })
|
||||
.regex(/^[a-zA-Z0-9]+$/), //Must be alphanumeric with hyphens or underscores
|
||||
.isUnique({ table: 'accounts', column: 'login', whereNot: (field) => field.meta.objId }),
|
||||
// .regex(/^[a-zA-Z0-9]+$/), //Must be alphanumeric with hyphens or underscores
|
||||
first_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
last_name: vine.string().trim().minLength(3).maxLength(255),
|
||||
email: vine
|
||||
.string()
|
||||
.maxLength(255)
|
||||
|
@ -49,10 +53,10 @@ let messagesProvider = new SimpleMessagesProvider({
|
|||
'unique': '{{ field }} must be unique, and this value is already taken',
|
||||
'string': 'The value of {{ field }} field must be a string',
|
||||
'email': 'The value is not a valid email address',
|
||||
'minLength': '{{ field }} must be at least {{ options.minLength }} characters long',
|
||||
'maxLength': '{{ field }} must be less then {{ options.maxLength }} characters long',
|
||||
'minLength': '{{ field }} must be at least {{ min }} characters long',
|
||||
'maxLength': '{{ field }} must be less then {{ max }} characters long',
|
||||
'confirmed': 'Oops! The confirmation of {{ field }} is not correct. Please double-check and ensure they match.',
|
||||
'roles.minLength': 'at least {{ options.minLength }} role must be defined',
|
||||
'roles.minLength': 'at least {{ min }} role must be defined',
|
||||
'roles.*.number': 'Define roles as valid numbers',
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue