mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Working on new version of website
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
23
app/Validators/user/UserStoreValidator.ts
Executable file
23
app/Validators/user/UserStoreValidator.ts
Executable file
@@ -0,0 +1,23 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
||||
|
||||
export default class UserStoreValidator {
|
||||
public schema = schema.create({
|
||||
email: schema.string({ trim: true, escape: true }, [
|
||||
rules.email(),
|
||||
rules.required(),
|
||||
rules.unique({
|
||||
table: 'users',
|
||||
column: 'email'
|
||||
})
|
||||
])
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required',
|
||||
'email.email': 'The email must be valid',
|
||||
'email.unique': 'The email is not unique'
|
||||
}
|
||||
|
||||
constructor (protected ctx: HttpContextContract) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user