mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
24 lines
617 B
TypeScript
24 lines
617 B
TypeScript
import { rules, schema } from '@ioc:Adonis/Core/Validator'
|
|
import type { 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) {
|
|
}
|
|
}
|