mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 18:29:15 +03:00
22 lines
728 B
TypeScript
22 lines
728 B
TypeScript
import { schema, rules } from '@ioc:Adonis/Core/Validator';
|
|
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
|
|
|
|
export default class UpdateContactsValidator {
|
|
constructor(protected ctx: HttpContextContract) {}
|
|
|
|
public schema = schema.create({
|
|
email: schema.string.optional({}, [rules.email()]),
|
|
phone_number: schema.string.optional({}, [
|
|
rules.mobile({
|
|
locales: ['ru-RU', 'en-US'],
|
|
strict: true,
|
|
}),
|
|
]),
|
|
vk_id: schema.string.optional({}, [rules.regex(/^[a-zA-Z0-9_]+$/)]),
|
|
twitter_id: schema.string.optional({}, [rules.regex(/^[a-zA-Z0-9_]+$/)]),
|
|
telegram_id: schema.string.optional({}, [rules.regex(/^[a-zA-Z0-9_]+$/)]),
|
|
});
|
|
|
|
public messages = {};
|
|
}
|