From 89e4db9b87187932849fbae2b59838791bee9a99 Mon Sep 17 00:00:00 2001 From: avicenan Date: Wed, 3 Jun 2026 11:35:43 +0900 Subject: [PATCH] fix(user): return hospital data on user detail --- src/controllers/user.ts | 8 ++++---- src/helpers/orm.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/controllers/user.ts b/src/controllers/user.ts index ab1d4b7..dc53def 100644 --- a/src/controllers/user.ts +++ b/src/controllers/user.ts @@ -14,7 +14,7 @@ import path from "path"; import fileUpload from "express-fileupload"; import { v4 as uuidv4 } from "uuid"; import config from "../../config/stag.json"; -import { IsNull } from "typeorm"; +import { IsNull, Not } from "typeorm"; const log: Logger = new Logger({ name: "[UserController]", @@ -1139,8 +1139,8 @@ export class UserController { // .where('utr.user_id = :id', { id: param.id }) // .getMany(); - // const repoHospital = OrmHelper.DB.getRepository(HospitalInformation); - // const hospital = await repoHospital.findOne({}); + const repoHospital = OrmHelper.DB.getRepository(HospitalInformation); + const hospital = await repoHospital.findOne({ where: { id: Not(IsNull()) } }); if (detail != null) { const data = { @@ -1149,7 +1149,7 @@ export class UserController { file_signature: detail.signature ? buildFileUrl(detail.signature) : null, profile: detail.profile_picture ?? null, profile_picture: detail.profile_picture ? buildFileUrl(detail.profile_picture) : null, - // hospital: hospital, + hospital: hospital, }; return ReturnHelper.successResponseAny(res, 200, Language.lang.success_view, data); diff --git a/src/helpers/orm.ts b/src/helpers/orm.ts index 306fb47..0459c77 100644 --- a/src/helpers/orm.ts +++ b/src/helpers/orm.ts @@ -6,7 +6,7 @@ import { Munisipo, Administrativu, Nationality, - Application, // + Application, Menu, User, UserActivity, @@ -16,6 +16,11 @@ import { HrmsEmployee, HrmsDepartment, HrmsShift, + HospitalInformation, + Province, + City, + Subdistrict, + Ward, } from "entity" import { ILogObj, Logger } from "tslog" @@ -53,6 +58,11 @@ export class OrmHelper { HrmsPosition, HrmsShift, HrmsEmployee, + HospitalInformation, + Province, + City, + Subdistrict, + Ward, ], subscribers: [], migrations: [],