fix(auth): return rooms on login
This commit is contained in:
@ -1131,20 +1131,19 @@ export class UserController {
|
||||
where: { id: param.id },
|
||||
});
|
||||
|
||||
// get all the rooms from the usertoroom
|
||||
// const repo = OrmHelper.DB.getRepository(UserToRoom);
|
||||
|
||||
// const rooms = await repo.createQueryBuilder('utr')
|
||||
// .select('utr.id_room')
|
||||
// .where('utr.user_id = :id', { id: param.id })
|
||||
// .getMany();
|
||||
|
||||
const repoHospital = OrmHelper.DB.getRepository(HospitalInformation);
|
||||
const hospital = await repoHospital.findOne({ where: { id: Not(IsNull()) } });
|
||||
|
||||
if (detail != null) {
|
||||
const query = `SELECT r.id, r.room, r.code
|
||||
FROM rooms r
|
||||
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`
|
||||
const rooms = await OrmHelper.DB.query(query, [detail.id])
|
||||
|
||||
const data = {
|
||||
...detail,
|
||||
rooms: rooms,
|
||||
signature: detail.signature ?? null,
|
||||
file_signature: detail.signature ? buildFileUrl(detail.signature) : null,
|
||||
profile: detail.profile_picture ?? null,
|
||||
|
||||
Reference in New Issue
Block a user