download kk1

This commit is contained in:
kittapath 2024-11-15 09:29:24 +07:00
parent 0e0cfda81c
commit 4880522497
3 changed files with 10 additions and 34 deletions

View file

@ -106,7 +106,6 @@ export class ProfileController extends Controller {
private districtRepo = AppDataSource.getRepository(District);
private subDistrictRepo = AppDataSource.getRepository(SubDistrict);
private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
@ -119,7 +118,6 @@ export class ProfileController extends Controller {
*/
@Get("kp7-short/{id}")
async kp7ShortById(@Path() id: string, @Request() req: RequestWithUser) {
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
const orgRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
@ -299,20 +297,7 @@ export class ProfileController extends Controller {
*/
@Get("kk1/{id}")
public async getKk1(@Path() id: string, @Request() req: RequestWithUser) {
//await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", id);
const profiles = await this.profileRepo.findOne({
// select: [
// "citizenId",
// "prefix",
// "firstName",
// "lastName",
// "birthDate",
// "currentAddress",
// "currentDistrictId",
// "currentProvinceId",
// "telephoneNumber",
// "avatar",
// ],
relations: ["currentSubDistrict", "currentDistrict", "currentProvince", "profileAvatars"],
order: {
profileAvatars: { createdAt: "ASC" },
@ -5785,9 +5770,10 @@ export class ProfileController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
education: profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""}/${profile.profileEducations[0].field ?? ""}`
: "-",
education:
profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""}/${profile.profileEducations[0].field ?? ""}`
: "-",
};
if (_profile.child4Id != null) {

View file

@ -143,7 +143,7 @@ export class ProfileEmployeeController extends Controller {
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
if (_workflow == false && req.user.sub != profile.keycloak)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
let ImgUrl: any;
if (profile?.avatar != null && profile?.avatarName != null) {
@ -292,8 +292,6 @@ export class ProfileEmployeeController extends Controller {
reportName: "docx-report",
data: mapData,
});
return new HttpSuccess(mapData);
}
/**
@ -312,13 +310,8 @@ export class ProfileEmployeeController extends Controller {
},
where: { id: id },
});
if (profiles) {
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_EMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profiles.id);
}
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let ImgUrl: any;
let ImgUrl: any = null;
let _ImgUrl: any = [];
if (profiles?.avatar != null && profiles?.avatarName != null) {
// await new CallAPI()
@ -327,6 +320,7 @@ export class ProfileEmployeeController extends Controller {
// ImgUrl = x.downloadUrl;
// })
// .catch();
let req_: any = req;
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");

View file

@ -140,7 +140,7 @@ export class ProfileEmployeeTempController extends Controller {
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
if (_workflow == false)
if (_workflow == false && req.user.sub != profile.keycloak)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_TEMP", profile.id);
let ImgUrl: any;
if (profile?.avatar != null && profile?.avatarName != null) {
@ -307,13 +307,8 @@ export class ProfileEmployeeTempController extends Controller {
},
where: { id: id },
});
if (profiles) {
let _workflow = await new permission().Workflow(req, id, "SYS_REGISTRY_TEMP");
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_TEMP", profiles.id);
}
if (!profiles) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
let ImgUrl: any;
let ImgUrl: any = null;
let _ImgUrl: any = [];
if (profiles?.avatar != null && profiles?.avatarName != null) {
// await new CallAPI()
@ -322,6 +317,7 @@ export class ProfileEmployeeTempController extends Controller {
// ImgUrl = x.downloadUrl;
// })
// .catch();
let req_: any = req;
const token_ = "Bearer " + req_.headers.authorization.replace("Bearer ", "");