fix report kk1/kp7 : add field imgUrl

This commit is contained in:
Bright 2024-09-23 11:48:10 +07:00
parent 917ca75eb2
commit 2d5f719fe2
3 changed files with 59 additions and 4 deletions

View file

@ -133,7 +133,15 @@ 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()
.GetData2(req, `/salary/file/${profile?.avatar}/${profile?.avatarName}`)
.then(async (x) => {
ImgUrl = x.downloadUrl
})
.catch();
}
const province = await this.provinceRepository.findOneBy({
id: profile.registrationProvinceId,
});
@ -241,6 +249,7 @@ export class ProfileController extends Controller {
: "-",
PositionName: profile.position != null ? profile.position : "-",
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
ImgUrl: ImgUrl ? ImgUrl : null
};
return new HttpSuccess(mapData);
@ -272,6 +281,16 @@ export class ProfileController extends Controller {
relations: ["currentSubDistrict", "currentDistrict", "currentProvince"],
where: { id: id },
});
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let ImgUrl: any
if(profiles?.avatar != null && profiles?.avatarName != null) {
await new CallAPI()
.GetData2(req, `/salary/file/${profiles?.avatar}/${profiles?.avatarName}`)
.then(async (x) => {
ImgUrl = x.downloadUrl
})
.catch();
}
const profileOc = await this.profileRepo.findOne({
relations: [
"current_holders",
@ -283,7 +302,6 @@ export class ProfileController extends Controller {
],
where: { id: id },
});
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (!profileOc) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
const orgRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
@ -432,6 +450,7 @@ export class ProfileController extends Controller {
? Extension.ToThaiNumber(profiles.currentProvince.name)
: "",
// AvatarId: profiles?.avatar ?? null,
ImgUrl: ImgUrl ? ImgUrl : null
};
const certs = await this.certificateRepository.find({