แก้เส้น post latest find ไม่ได้

This commit is contained in:
AdisakKanthawilang 2025-04-08 10:46:44 +07:00
parent 230b552f6d
commit 1126df613c
2 changed files with 18 additions and 17 deletions

View file

@ -70,56 +70,56 @@ export class SalaryPeriodController extends Controller {
const data = { const data = {
group1id: group1id:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.id, )?.id,
group1IsClose: group1IsClose:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.isClose, )?.isClose,
group2id: group2id:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.id, )?.id,
group2IsClose: group2IsClose:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&

View file

@ -67,59 +67,58 @@ export class SalaryPeriodEmployeeController extends Controller {
if (!salaryPeriod) { if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
} }
const data = { const data = {
group1id: group1id:
salaryPeriod.salaryOrgEmployees.find( salaryPeriod.salaryOrgEmployees && salaryPeriod.salaryOrgEmployees.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgEmployees.find( : salaryPeriod.salaryOrgEmployees && salaryPeriod.salaryOrgEmployees.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.id, )?.id,
group1IsClose: group1IsClose:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP1" && x.group == "GROUP1" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.isClose, )?.isClose,
group2id: group2id:
salaryPeriod.salaryOrgEmployees.find( salaryPeriod.salaryOrgEmployees && salaryPeriod.salaryOrgEmployees.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgEmployees.find( : salaryPeriod.salaryOrgEmployees && salaryPeriod.salaryOrgEmployees.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
)?.id, )?.id,
group2IsClose: group2IsClose:
salaryPeriod.salaryOrgs.find( salaryPeriod.salaryOrgs &&salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
x.snapshot == body.snapshot.toLocaleUpperCase(), x.snapshot == body.snapshot.toLocaleUpperCase(),
) == null ) == null
? null ? null
: salaryPeriod.salaryOrgs.find( : salaryPeriod.salaryOrgs && salaryPeriod.salaryOrgs.find(
(x) => (x) =>
x.group == "GROUP2" && x.group == "GROUP2" &&
x.rootId == body.rootId && x.rootId == body.rootId &&
@ -128,6 +127,8 @@ export class SalaryPeriodEmployeeController extends Controller {
effectiveDate: salaryPeriod.effectiveDate, effectiveDate: salaryPeriod.effectiveDate,
period: salaryPeriod.period, period: salaryPeriod.period,
}; };
return new HttpSuccess(data); return new HttpSuccess(data);
} }