api login
This commit is contained in:
parent
bd0daf5858
commit
1a7473362b
8 changed files with 613 additions and 60 deletions
|
|
@ -1,14 +1,12 @@
|
|||
import Joi from 'joi';
|
||||
|
||||
export const loginSchema = Joi.object({
|
||||
username: Joi.string()
|
||||
.min(3)
|
||||
.max(50)
|
||||
email: Joi.string()
|
||||
.email({ tlds: { allow: false } }) // Allow any TLD including .local
|
||||
.required()
|
||||
.messages({
|
||||
'string.min': 'Username must be at least 3 characters',
|
||||
'string.max': 'Username must not exceed 50 characters',
|
||||
'any.required': 'Username is required'
|
||||
'string.email': 'Please provide a valid email address',
|
||||
'any.required': 'Email is required'
|
||||
}),
|
||||
password: Joi.string()
|
||||
.min(6)
|
||||
|
|
@ -47,6 +45,10 @@ export const registerSchema = Joi.object({
|
|||
'string.max': 'Password must not exceed 100 characters',
|
||||
'any.required': 'Password is required'
|
||||
}),
|
||||
prefix: Joi.object({
|
||||
th: Joi.string().optional(),
|
||||
en: Joi.string().optional()
|
||||
}).optional(),
|
||||
first_name: Joi.string()
|
||||
.min(1)
|
||||
.max(100)
|
||||
|
|
@ -61,10 +63,13 @@ export const registerSchema = Joi.object({
|
|||
.messages({
|
||||
'any.required': 'Last name is required'
|
||||
}),
|
||||
prefix: Joi.object({
|
||||
th: Joi.string().optional(),
|
||||
en: Joi.string().optional()
|
||||
}).optional()
|
||||
phone: Joi.string()
|
||||
.min(10)
|
||||
.max(15)
|
||||
.required()
|
||||
.messages({
|
||||
'any.required': 'Phone number is required'
|
||||
})
|
||||
});
|
||||
|
||||
export const refreshTokenSchema = Joi.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue