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,
|
ProfileHistory,
|
||||||
CreateProfileAllFields,
|
CreateProfileAllFields,
|
||||||
} from "../entities/Profile";
|
} from "../entities/Profile";
|
||||||
import { Brackets, IsNull, Like, Not } from "typeorm";
|
import { Any, Brackets, IsNull, Like, Not } from "typeorm";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
import { PosLevel } from "../entities/PosLevel";
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
|
|
@ -61,6 +61,7 @@ import { ProfileLeave } from "../entities/ProfileLeave";
|
||||||
import { updateName } from "../keycloak";
|
import { updateName } from "../keycloak";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
import { PosMasterAct } from "../entities/PosMasterAct";
|
import { PosMasterAct } from "../entities/PosMasterAct";
|
||||||
|
import axios from "axios";
|
||||||
@Route("api/v1/org/profile")
|
@Route("api/v1/org/profile")
|
||||||
@Tags("Profile")
|
@Tags("Profile")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -135,12 +136,25 @@ export class ProfileController extends Controller {
|
||||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
let ImgUrl: any;
|
let ImgUrl: any;
|
||||||
if (profile?.avatar != null && profile?.avatarName != null) {
|
if (profile?.avatar != null && profile?.avatarName != null) {
|
||||||
await new CallAPI()
|
// await new CallAPI()
|
||||||
.GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
// .GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||||
.then(async (x) => {
|
// .then(async (x) => {
|
||||||
ImgUrl = x.downloadUrl;
|
// ImgUrl = x.downloadUrl;
|
||||||
})
|
// })
|
||||||
.catch();
|
// .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({
|
const province = await this.provinceRepository.findOneBy({
|
||||||
id: profile.registrationProvinceId,
|
id: profile.registrationProvinceId,
|
||||||
|
|
@ -286,12 +300,26 @@ export class ProfileController extends Controller {
|
||||||
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
let ImgUrl: any;
|
let ImgUrl: any;
|
||||||
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
||||||
await new CallAPI()
|
// await new CallAPI()
|
||||||
.GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
// .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||||
.then(async (x) => {
|
// .then(async (x) => {
|
||||||
ImgUrl = x.downloadUrl;
|
// ImgUrl = x.downloadUrl;
|
||||||
})
|
// })
|
||||||
.catch();
|
// .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({
|
const profileOc = await this.profileRepo.findOne({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ import CallAPI from "../interfaces/call-api";
|
||||||
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
import { ProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
|
import axios from "axios";
|
||||||
@Route("api/v1/org/profile-employee")
|
@Route("api/v1/org/profile-employee")
|
||||||
@Tags("ProfileEmployee")
|
@Tags("ProfileEmployee")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -141,12 +142,25 @@ export class ProfileEmployeeController extends Controller {
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
|
||||||
let ImgUrl: any;
|
let ImgUrl: any;
|
||||||
if (profile?.avatar != null && profile?.avatarName != null) {
|
if (profile?.avatar != null && profile?.avatarName != null) {
|
||||||
await new CallAPI()
|
// await new CallAPI()
|
||||||
.GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
// .GetData(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
|
||||||
.then(async (x) => {
|
// .then(async (x) => {
|
||||||
ImgUrl = x.downloadUrl;
|
// ImgUrl = x.downloadUrl;
|
||||||
})
|
// })
|
||||||
.catch();
|
// .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({
|
const province = await this.provinceRepository.findOneBy({
|
||||||
id: profile.registrationProvinceId,
|
id: profile.registrationProvinceId,
|
||||||
|
|
@ -296,12 +310,25 @@ export class ProfileEmployeeController extends Controller {
|
||||||
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
let ImgUrl: any;
|
let ImgUrl: any;
|
||||||
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
if (profiles?.avatar != null && profiles?.avatarName != null) {
|
||||||
await new CallAPI()
|
// await new CallAPI()
|
||||||
.GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
// .GetData(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
|
||||||
.then(async (x) => {
|
// .then(async (x) => {
|
||||||
ImgUrl = x.downloadUrl;
|
// ImgUrl = x.downloadUrl;
|
||||||
})
|
// })
|
||||||
.catch();
|
// .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({
|
const profileOc = await this.profileRepo.findOne({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue