forked from geolba/tethys.backend
- add validator for checking languages of translated titles and description
- add notification messages via notiwind.ts - add Project.ts - add new component TabelPersons.vue - add additional routes - npm updates
This commit is contained in:
parent
59a99ff3c8
commit
080c21126b
24 changed files with 979 additions and 349 deletions
|
@ -133,6 +133,9 @@ Route.group(() => {
|
|||
Route.post('/dataset/second/second-step', 'DatasetController.secondStep')
|
||||
.as('dataset.second.step')
|
||||
.middleware(['auth', 'can:dataset-submit']);
|
||||
Route.post('/dataset/second/third-step', 'DatasetController.thirdStep')
|
||||
.as('dataset.third.step')
|
||||
.middleware(['auth', 'can:dataset-submit']);
|
||||
// Route.get('/user/:id', 'UsersController.show').as('user.show').where('id', Route.matchers.number());
|
||||
// Route.get('/user/:id/edit', 'UsersController.edit').as('user.edit').where('id', Route.matchers.number());
|
||||
// Route.put('/user/:id/update', 'UsersController.update').as('user.update').where('id', Route.matchers.number());
|
||||
|
|
46
start/validator.ts
Normal file
46
start/validator.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Preloaded File
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Any code written inside this file will be executed during the application
|
||||
| boot.
|
||||
https://issuehunt.io/r/adonisjs/validator/issues/84
|
||||
|
|
||||
*/
|
||||
// import { string } from '@ioc:Adonis/Core/Helpers';
|
||||
import { validator } from '@ioc:Adonis/Core/Validator';
|
||||
|
||||
validator.rule(
|
||||
'translatedLanguage',
|
||||
(value, [mainLanguageField, typeField], { root, tip, pointer, arrayExpressionPointer, errorReporter }) => {
|
||||
if (typeof value !== 'string') {
|
||||
return;
|
||||
}
|
||||
// const fieldValue = validator. getValue(data, field)
|
||||
// this should return the "category_id" value present in "root", but i got undefined
|
||||
const mainLanguage = validator.helpers.getFieldValue(mainLanguageField, root, tip);
|
||||
const type = validator.helpers.getFieldValue(typeField, root, tip);
|
||||
|
||||
if (type && type == 'Translated') {
|
||||
if (value == mainLanguage) {
|
||||
errorReporter.report(
|
||||
pointer,
|
||||
'translatedLanguage', // Keep an eye on this
|
||||
'translatedLanguage validation failed',
|
||||
arrayExpressionPointer,
|
||||
{ mainLanguage },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// if (value !== string.camelCase(value)) {
|
||||
// options.errorReporter.report(
|
||||
// options.pointer,
|
||||
// 'camelCase',
|
||||
// 'camelCase validation failed',
|
||||
// options.arrayExpressionPointer
|
||||
// );
|
||||
// }
|
||||
},
|
||||
);
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue