fix load report err
This commit is contained in:
parent
f938541733
commit
939ed6ddfd
2 changed files with 80 additions and 25 deletions
|
|
@ -26,7 +26,7 @@ import {
|
|||
ProfileHistory,
|
||||
CreateProfileAllFields,
|
||||
} from "../entities/Profile";
|
||||
import { Brackets, IsNull, Like, Not } from "typeorm";
|
||||
import { Any, Brackets, IsNull, Like, Not } from "typeorm";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
import { PosMaster } from "../entities/PosMaster";
|
||||
import { PosLevel } from "../entities/PosLevel";
|
||||
|
|
@ -61,6 +61,7 @@ import { ProfileLeave } from "../entities/ProfileLeave";
|
|||
import { updateName } from "../keycloak";
|
||||
import permission from "../interfaces/permission";
|
||||
import { PosMasterAct } from "../entities/PosMasterAct";
|
||||
import axios from "axios";
|
||||
@Route("api/v1/org/profile")
|
||||
@Tags("Profile")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -135,12 +136,25 @@ export class ProfileController extends Controller {
|
|||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
let ImgUrl: any;
|
||||
if (profile?.avatar != null && profile?.avatarName != null) {
|
||||
await new CallAPI()
|
||||
.GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||
.then(async (x) => {
|
||||
ImgUrl = x.downloadUrl;
|
||||
})
|
||||
.catch();
|
||||
// await new CallAPI()
|
||||
// .GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||
// .then(async (x) => {
|
||||
// ImgUrl = x.downloadUrl;
|
||||
// })
|
||||
// .catch();
|
||||
let req_: any = req;
|
||||
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
||||
const url = process.env.API_URL + `/salary/file/${profile?.avatar}/${profile?.avatarName}`;
|
||||
try {
|
||||
const response_ = await axios.get(url, {
|
||||
headers: {
|
||||
Authorization: `${token_}`,
|
||||
"Content-Type": "application/json",
|
||||
api_key: process.env.API_KEY,
|
||||
},
|
||||
});
|
||||
ImgUrl = response_.data.downloadUrl;
|
||||
} catch { }
|
||||
}
|
||||
const province = await this.provinceRepository.findOneBy({
|
||||
id: profile.registrationProvinceId,
|
||||
|
|
@ -286,12 +300,26 @@ export class ProfileController extends Controller {
|
|||
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
let ImgUrl: any;
|
||||
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
||||
await new CallAPI()
|
||||
.GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||
.then(async (x) => {
|
||||
ImgUrl = x.downloadUrl;
|
||||
})
|
||||
.catch();
|
||||
// await new CallAPI()
|
||||
// .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||
// .then(async (x) => {
|
||||
// ImgUrl = x.downloadUrl;
|
||||
// })
|
||||
// .catch();
|
||||
|
||||
let req_: any = req;
|
||||
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
||||
const url = process.env.API_URL + `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`;
|
||||
try {
|
||||
const response_ = await axios.get(url, {
|
||||
headers: {
|
||||
Authorization: `${token_}`,
|
||||
"Content-Type": "application/json",
|
||||
api_key: process.env.API_KEY,
|
||||
},
|
||||
});
|
||||
ImgUrl = response_.data.downloadUrl;
|
||||
} catch { }
|
||||
}
|
||||
const profileOc = await this.profileRepo.findOne({
|
||||
relations: [
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ import CallAPI from "../interfaces/call-api";
|
|||
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||
import permission from "../interfaces/permission";
|
||||
import axios from "axios";
|
||||
@Route("api/v1/org/profile-employee")
|
||||
@Tags("ProfileEmployee")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -141,12 +142,25 @@ export class ProfileEmployeeController extends Controller {
|
|||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||
let ImgUrl: any;
|
||||
if (profile?.avatar != null && profile?.avatarName != null) {
|
||||
await new CallAPI()
|
||||
.GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||
.then(async (x) => {
|
||||
ImgUrl = x.downloadUrl;
|
||||
})
|
||||
.catch();
|
||||
// await new CallAPI()
|
||||
// .GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||
// .then(async (x) => {
|
||||
// ImgUrl = x.downloadUrl;
|
||||
// })
|
||||
// .catch();
|
||||
let req_: any = req;
|
||||
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
||||
const url = process.env.API_URL + `/salary/file/${profile?.avatar}/${profile?.avatarName}`;
|
||||
try {
|
||||
const response_ = await axios.get(url, {
|
||||
headers: {
|
||||
Authorization: `${token_}`,
|
||||
"Content-Type": "application/json",
|
||||
api_key: process.env.API_KEY,
|
||||
},
|
||||
});
|
||||
ImgUrl = response_.data.downloadUrl;
|
||||
} catch { }
|
||||
}
|
||||
const province = await this.provinceRepository.findOneBy({
|
||||
id: profile.registrationProvinceId,
|
||||
|
|
@ -296,12 +310,25 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
let ImgUrl: any;
|
||||
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
||||
await new CallAPI()
|
||||
.GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||
.then(async (x) => {
|
||||
ImgUrl = x.downloadUrl;
|
||||
})
|
||||
.catch();
|
||||
// await new CallAPI()
|
||||
// .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||
// .then(async (x) => {
|
||||
// ImgUrl = x.downloadUrl;
|
||||
// })
|
||||
// .catch();
|
||||
let req_: any = req;
|
||||
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");
|
||||
const url = process.env.API_URL + `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`;
|
||||
try {
|
||||
const response_ = await axios.get(url, {
|
||||
headers: {
|
||||
Authorization: `${token_}`,
|
||||
"Content-Type": "application/json",
|
||||
api_key: process.env.API_KEY,
|
||||
},
|
||||
});
|
||||
ImgUrl = response_.data.downloadUrl;
|
||||
} catch { }
|
||||
}
|
||||
const profileOc = await this.profileRepo.findOne({
|
||||
relations: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue