mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-27 10:00:27 +01:00
Working on new version of website
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
22
app/Validators/translation/TranslationStoreValidator.ts
Normal file
22
app/Validators/translation/TranslationStoreValidator.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
|
||||
export default class TranslationStoreValidator {
|
||||
public schema = schema.create({
|
||||
code: schema.string({}, [
|
||||
rules.unique({
|
||||
table: 'translations',
|
||||
column: 'code'
|
||||
})
|
||||
]),
|
||||
english: schema.string.optional(),
|
||||
french: schema.string.optional()
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'code.unique': 'The translation code is not unique !'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user