mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-01-22 17:51:31 +01:00
Create user methods
This commit is contained in:
27
app/Validators/users/UserUpdateValidator.ts
Executable file
27
app/Validators/users/UserUpdateValidator.ts
Executable file
@@ -0,0 +1,27 @@
|
||||
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 = {}
|
||||
}
|
||||
Reference in New Issue
Block a user