return facility data when login
This commit is contained in:
@ -115,11 +115,17 @@ export class AuthController {
|
|||||||
hrms.level_name = user.employee.position?.name || null
|
hrms.level_name = user.employee.position?.name || null
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = `SELECT r.id, r.room, r.code
|
const roomQuery = `SELECT r.id, r.room, r.code
|
||||||
FROM rooms r
|
FROM rooms r
|
||||||
INNER JOIN user_to_room utr ON utr.room_id = r.id
|
INNER JOIN user_to_room utr ON utr.room_id = r.id
|
||||||
WHERE utr.user_id = $1 AND r.deleted_at IS NULL AND utr.deleted_at IS NULL`
|
WHERE utr.user_id = $1 AND r.deleted_at IS NULL AND utr.deleted_at IS NULL`
|
||||||
const rooms = await OrmHelper.DB.query(query, [user.id])
|
const rooms = await OrmHelper.DB.query(roomQuery, [user.id])
|
||||||
|
|
||||||
|
const facilityQuery = `SELECT f.id, f.facility_id, .f.name, f.address, f.phone, f.code
|
||||||
|
FROM hospital_information f
|
||||||
|
LIMIT 1`
|
||||||
|
const facilities = await OrmHelper.DB.query(facilityQuery)
|
||||||
|
const facility = facilities[0] || null
|
||||||
|
|
||||||
var privateKey = fs.readFileSync("src/helpers/key/private.key")
|
var privateKey = fs.readFileSync("src/helpers/key/private.key")
|
||||||
|
|
||||||
@ -134,6 +140,7 @@ export class AuthController {
|
|||||||
roles: roles.roles,
|
roles: roles.roles,
|
||||||
hrms: hrms,
|
hrms: hrms,
|
||||||
rooms: rooms,
|
rooms: rooms,
|
||||||
|
facility: facility,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
privateKey,
|
privateKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user