mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
24 lines
613 B
TypeScript
24 lines
613 B
TypeScript
import { rules, schema } from '@ioc:Adonis/Core/Validator'
|
|
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
|
|
|
export default class TranslationUpdateValidator {
|
|
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) {
|
|
}
|
|
}
|