fix(auth): return facility hospital when login
This commit is contained in:
@ -11,7 +11,7 @@ import dayjs from "dayjs"
|
||||
import jwt from "jsonwebtoken"
|
||||
import fs from "fs"
|
||||
import { v4 as uuidv4 } from "uuid"
|
||||
import { Application, EmailBody, HrmsEmployee, Menu, User, UserRefreshToken, UserRole } from "entity"
|
||||
import { Application, EmailBody, HospitalInformation, HrmsEmployee, Menu, User, UserRefreshToken, UserRole } from "entity"
|
||||
import axios from "axios"
|
||||
import CommonHelper from "../helpers/common"
|
||||
import { MoreThan } from "typeorm"
|
||||
@ -121,12 +121,17 @@ export class AuthController {
|
||||
WHERE utr.user_id = $1 AND r.deleted_at IS NULL AND utr.deleted_at IS NULL`
|
||||
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
|
||||
const facility = await OrmHelper.DB.getRepository(HospitalInformation).findOne({
|
||||
select: {
|
||||
id: true,
|
||||
facility_id: true,
|
||||
name: true,
|
||||
address: true,
|
||||
phone: true,
|
||||
code: true,
|
||||
},
|
||||
where: {},
|
||||
})
|
||||
|
||||
var privateKey = fs.readFileSync("src/helpers/key/private.key")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user