get me api
This commit is contained in:
parent
815e8aeaf0
commit
d8d3dff2e7
8 changed files with 1719 additions and 575 deletions
36
Backend/src/validators/user.validator.ts
Normal file
36
Backend/src/validators/user.validator.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import Joi from 'joi';
|
||||
|
||||
export const profileUpdateSchema = Joi.object({
|
||||
prefix: Joi.object({
|
||||
th: Joi.string().optional(),
|
||||
en: Joi.string().optional()
|
||||
}).optional(),
|
||||
first_name: Joi.string()
|
||||
.min(1)
|
||||
.max(100)
|
||||
.optional(),
|
||||
last_name: Joi.string()
|
||||
.min(1)
|
||||
.max(100)
|
||||
.optional(),
|
||||
phone: Joi.string()
|
||||
.min(10)
|
||||
.max(15)
|
||||
.optional(),
|
||||
avatar_url: Joi.string().optional(),
|
||||
birthday: Joi.date().optional()
|
||||
});
|
||||
|
||||
export const changePasswordSchema = Joi.object({
|
||||
old_password: Joi.string()
|
||||
.required()
|
||||
.messages({
|
||||
'any.required': 'Old password is required'
|
||||
}),
|
||||
new_password: Joi.string()
|
||||
.required()
|
||||
.messages({
|
||||
'any.required': 'New password is required'
|
||||
})
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue