mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-01-14 22:59:53 +01:00
28 lines
614 B
TypeScript
Executable File
28 lines
614 B
TypeScript
Executable File
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
|
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
|
|
|
export default class UserUpdateValidator {
|
|
constructor (protected ctx: HttpContextContract) {}
|
|
|
|
public schema = schema.create({
|
|
email: schema.string.optional({ trim: true },
|
|
[
|
|
rules.email(),
|
|
rules.unique(
|
|
{
|
|
table: 'users',
|
|
column: 'email'
|
|
})
|
|
]
|
|
),
|
|
password: schema.string.optional({ trim: true },
|
|
[
|
|
rules.confirmed(),
|
|
rules.minLength(8)
|
|
]
|
|
)
|
|
})
|
|
|
|
public messages = {}
|
|
}
|