fix ข้อมูลตำแหน่ง-เงินเดือน (หน่วยงานที่ออกคำสั่งไม่แสดง) #1394
This commit is contained in:
parent
d4f745c61f
commit
921e23f81a
3 changed files with 245 additions and 9 deletions
|
|
@ -2952,6 +2952,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile: any = await this.profileRepository.findOneBy({ id: item.profileId });
|
||||
|
|
@ -2975,7 +2991,7 @@ export class CommandController extends Controller {
|
|||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
Object.assign(data, { ...item, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
|
@ -3084,6 +3100,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile: any = await this.profileEmployeeRepository.findOneBy({ id: item.profileId });
|
||||
|
|
@ -3097,7 +3129,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
|
|
@ -3235,6 +3267,22 @@ export class CommandController extends Controller {
|
|||
const roleKeycloak = await this.roleKeycloakRepo.findOne({
|
||||
where: { name: Like("USER") },
|
||||
});
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile = await this.profileRepository.findOne({
|
||||
|
|
@ -3261,7 +3309,7 @@ export class CommandController extends Controller {
|
|||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
Object.assign(data, { ...item, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
|
@ -3408,6 +3456,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile = await this.profileEmployeeRepository.findOne({
|
||||
|
|
@ -3424,7 +3488,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
|
|
@ -3525,6 +3589,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile: any = await this.profileRepository.findOne({
|
||||
|
|
@ -3541,7 +3621,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
|
|
@ -3790,6 +3870,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
if (item.profileType && item.profileType.trim().toUpperCase() == "OFFICER") {
|
||||
|
|
@ -3863,6 +3959,7 @@ export class CommandController extends Controller {
|
|||
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
|
||||
// ประวัติตำแหน่ง
|
||||
const data = new ProfileSalary();
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileId: profile.id,
|
||||
commandId: item.commandId,
|
||||
|
|
@ -4056,6 +4153,7 @@ export class CommandController extends Controller {
|
|||
// ?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
|
||||
// ประวัติตำแหน่ง
|
||||
const data = new ProfileSalary();
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileEmployeeId: profile.id,
|
||||
commandId: item.commandId,
|
||||
|
|
@ -4224,6 +4322,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile = await this.profileEmployeeRepository.findOne({
|
||||
|
|
@ -4295,6 +4409,7 @@ export class CommandController extends Controller {
|
|||
// ?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
|
||||
// ประวัติตำแหน่ง
|
||||
const data = new ProfileSalary();
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileEmployeeId: profile.id,
|
||||
commandId: item.commandId,
|
||||
|
|
@ -4451,6 +4566,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile = await this.profileRepository.findOne({
|
||||
|
|
@ -4523,6 +4654,7 @@ export class CommandController extends Controller {
|
|||
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
|
||||
// ประวัติตำแหน่ง
|
||||
const data = new ProfileSalary();
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileId: item.profileId,
|
||||
commandId: item.commandId,
|
||||
|
|
@ -4610,6 +4742,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const profile = await this.profileRepository.findOne({
|
||||
|
|
@ -4735,6 +4883,7 @@ export class CommandController extends Controller {
|
|||
commandCode: item.commandCode,
|
||||
commandName: item.commandName,
|
||||
remark: item.remark,
|
||||
posNumCodeSit: _posNumCodeSit
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
@ -4816,6 +4965,24 @@ export class CommandController extends Controller {
|
|||
const list = await getRoles();
|
||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||
const _null: any = null;
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: {
|
||||
id: body.data.find(x => x.bodySalarys?.commandId)?.bodySalarys?.commandId ?? ""
|
||||
}
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.data.map(async (item) => {
|
||||
const before = null;
|
||||
|
|
@ -5106,6 +5273,7 @@ export class CommandController extends Controller {
|
|||
order: { order: "DESC" },
|
||||
});
|
||||
const profileSal: any = new ProfileSalary();
|
||||
profileSal.posNumCodeSit = _posNumCodeSit;
|
||||
Object.assign(profileSal, { ...item.bodySalarys, ...meta });
|
||||
const salaryHistory = new ProfileSalaryHistory();
|
||||
Object.assign(salaryHistory, { ...profileSal, id: undefined });
|
||||
|
|
@ -5276,6 +5444,22 @@ export class CommandController extends Controller {
|
|||
const roleKeycloak = await this.roleKeycloakRepo.findOne({
|
||||
where: { name: Like("USER") },
|
||||
});
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.refIds.map(async (item) => {
|
||||
const profile = await this.profileEmployeeRepository.findOne({
|
||||
|
|
@ -5325,7 +5509,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileEmployeeId: profile.id,
|
||||
amount: item.amount,
|
||||
|
|
@ -5782,6 +5966,22 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.refIds.find(x => x.commandId)?.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepository.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
body.refIds.map(async (item) => {
|
||||
const posMaster = await this.posMasterRepository.findOne({
|
||||
|
|
@ -5834,7 +6034,7 @@ export class CommandController extends Controller {
|
|||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
profileId: profile?.id,
|
||||
date: new Date(),
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { TenurePositionOfficer } from "../entities/TenurePositionOfficer";
|
|||
import { TenureLevelOfficer } from "../entities/TenureLevelOfficer";
|
||||
import { TenurePositionEmployee } from "../entities/TenurePositionEmployee";
|
||||
import { TenureLevelEmployee } from "../entities/TenureLevelEmployee";
|
||||
import { Command } from "../entities/Command";
|
||||
@Route("api/v1/org/profile/salary")
|
||||
@Tags("ProfileSalary")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -39,6 +40,7 @@ export class ProfileSalaryController extends Controller {
|
|||
private positionEmployeeRepo = AppDataSource.getRepository(TenurePositionEmployee);
|
||||
private levelOfficerRepo = AppDataSource.getRepository(TenureLevelOfficer);
|
||||
private levelEmployeeRepo = AppDataSource.getRepository(TenureLevelEmployee);
|
||||
private commandRepository = AppDataSource.getRepository(Command);
|
||||
|
||||
@Get("TenurePositionOfficer")
|
||||
public async cronjobTenurePositionOfficer() {
|
||||
|
|
@ -671,8 +673,24 @@ export class ProfileSalaryController extends Controller {
|
|||
order: { order: "DESC" },
|
||||
});
|
||||
const before = null;
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepo.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
|
|||
import { In, LessThan, MoreThan } from "typeorm";
|
||||
import permission from "../interfaces/permission";
|
||||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
import { Command } from "../entities/Command";
|
||||
@Route("api/v1/org/profile-employee/salary")
|
||||
@Tags("ProfileSalary")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -33,6 +34,7 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
private profileRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
||||
private commandRepository = AppDataSource.getRepository(Command);
|
||||
|
||||
@Get("user")
|
||||
public async getSalaryUser(@Request() request: { user: Record<string, any> }) {
|
||||
|
|
@ -353,8 +355,24 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
order: { order: "DESC" },
|
||||
});
|
||||
const before = null;
|
||||
let _posNumCodeSit: string = ""
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.commandId ?? "" }
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok == "OFFICE") _posNumCodeSit = "สำนักปลัดกรุงเทพมหานคร"
|
||||
else if (_command?.isBangkok == "BANGKOK") _posNumCodeSit = "กรุงเทพมหานคร"
|
||||
else {
|
||||
let _profileAdmin = await this.profileRepo.findOne({
|
||||
where: { keycloak: _command?.createdUserId.toString()},
|
||||
relations: ["current_holders", "current_holders.orgRoot",]
|
||||
});
|
||||
_posNumCodeSit = _profileAdmin?.current_holders
|
||||
.find(x => x.orgRoot.orgRootName)?.orgRoot.orgRootName ?? ""
|
||||
}
|
||||
}
|
||||
const data = new ProfileSalary();
|
||||
|
||||
data.posNumCodeSit = _posNumCodeSit;
|
||||
const meta = {
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue