fix(auth): return rooms on login

This commit is contained in:
avicenan
2026-06-05 15:16:25 +09:00
parent 89e4db9b87
commit a783b94561
2 changed files with 15 additions and 9 deletions

View File

@ -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,