diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index fb70508..9259034 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -145,6 +145,7 @@ export class AuthController { const data = { user: { ...user, ...hrms, rooms }, role_name: roles.name, + default_page: roles.default_page ?? null, roles_list: await AuthController.getListRole(roles.roles), token: { access_token: token, diff --git a/src/controllers/user_roles.ts b/src/controllers/user_roles.ts index b03cb8c..b3078a3 100644 --- a/src/controllers/user_roles.ts +++ b/src/controllers/user_roles.ts @@ -250,6 +250,7 @@ export class UserRoleController { application: Joi.string().required().label("Application"), is_doctor: Joi.bool().optional().label("Is Doctor"), is_nurse: Joi.bool().optional().label("Is Nurse"), + default_page: Joi.string().max(256).allow(null, "").optional().label("Default Page"), }) const param: UserRole & { application: string } = await schema.validateAsync(req.body) @@ -263,6 +264,7 @@ export class UserRoleController { data.application = await repo_app.findOneBy({ id: param.application }) data.is_doctor = param.is_doctor data.is_nurse = param.is_nurse + data.default_page = param.default_page?.trim() || null data.created_by = req.auth.data.name data.created_at = new Date() @@ -315,6 +317,7 @@ export class UserRoleController { application: Joi.string().required().label("Application"), is_doctor: Joi.bool().optional().label("Is Doctor"), is_nurse: Joi.bool().optional().label("Is Nurse"), + default_page: Joi.string().max(256).allow(null, "").optional().label("Default Page"), }) req.body.id = req.params["id"] @@ -334,6 +337,7 @@ export class UserRoleController { data.application = await repo_app.findOneBy({ id: param.application }) data.is_doctor = param.is_doctor data.is_nurse = param.is_nurse + data.default_page = param.default_page?.trim() || null data.updated_by = req.auth.data.name data.updated_at = new Date()