import { schema, rules } from '@ioc:Adonis/Core/Validator'; import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; export default class UpdateUserValidator { constructor(protected ctx: HttpContextContract) {} public schema = schema.create({ name: schema.string.optional(), surname: schema.string.optional(), patronymic: schema.string.optional(), login: schema.string.optional(), email: schema.string.optional({}, [ rules.email(), rules.unique({ table: 'users', column: 'email' }), ]), password: schema.string.optional(), }); /** * Custom messages for validation failures. You can make use of dot notation `(.)` * for targeting nested fields and array expressions `(*)` for targeting all * children of an array. For example: * * { * 'profile.username.required': 'Username is required', * 'scores.*.number': 'Define scores as valid numbers' * } * */ public messages = {}; }