no message
This commit is contained in:
parent
9bf37a2f1d
commit
c3cecbc763
1 changed files with 48 additions and 47 deletions
|
|
@ -18,7 +18,7 @@ import { AppDataSource } from "../database/data-source";
|
|||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { Brackets, In, IsNull, Like, Not } from "typeorm";
|
||||
import { Brackets, Double, In, IsNull, Like, Not } from "typeorm";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
|
||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
|
|
@ -619,12 +619,12 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async deleteProfile(@Path() id: string) {
|
||||
const result = await this.profileRepo.findOne({ where: { id: id } });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await this.informationHistoryRepository.delete({profileEmployeeId: id});
|
||||
await this.profileRepo.remove(result);
|
||||
const result = await this.profileRepo.findOne({ where: { id: id } });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
await this.informationHistoryRepository.delete({ profileEmployeeId: id });
|
||||
await this.profileRepo.remove(result);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
@ -826,14 +826,14 @@ export class ProfileEmployeeController extends Controller {
|
|||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4"
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
if (!profiles) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
|
||||
const findRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
|
|
@ -841,39 +841,40 @@ export class ProfileEmployeeController extends Controller {
|
|||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||
}
|
||||
|
||||
const formattedData = profiles.map((profile) => {
|
||||
const fullName = `${profile.prefix} ${profile.firstName} ${profile.lastName}`;
|
||||
const shortName =
|
||||
profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: null;
|
||||
const formattedData = profiles.map((profile) => {
|
||||
const fullName = `${profile.prefix} ${profile.firstName} ${profile.lastName}`;
|
||||
const shortName =
|
||||
profile.current_holders.length == 0
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 !=
|
||||
null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild3 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild2 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild1 != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
|
||||
null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgRoot != null
|
||||
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: null;
|
||||
|
||||
const root =
|
||||
profile.current_holders.length == 0 ||
|
||||
(profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
const root =
|
||||
profile.current_holders.length == 0 ||
|
||||
(profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
return {
|
||||
id: profile.id,
|
||||
|
|
@ -910,7 +911,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
positionLevel: profile.posLevel?.posLevelName,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
return new HttpSuccess(formattedData);
|
||||
}
|
||||
|
||||
|
|
@ -2972,9 +2973,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
id: string;
|
||||
personId: string;
|
||||
templateDoc: string;
|
||||
amount: string;
|
||||
positionSalaryAmount: string;
|
||||
mouthSalaryAmount: string;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
mouthSalaryAmount: Double | null;
|
||||
refCommandNo: string;
|
||||
}[];
|
||||
},
|
||||
|
|
@ -3005,7 +3006,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
})
|
||||
.then(async (x) => {
|
||||
profile.statusTemp = "DONE";
|
||||
profile.employeeClass = "TEMP";
|
||||
profile.employeeClass = "PERM";
|
||||
await this.profileRepo.save(profile);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue