add update time
This commit is contained in:
parent
ad4efc2b47
commit
a2292d6048
57 changed files with 257 additions and 98 deletions
|
|
@ -132,7 +132,7 @@ export class ProfileAbilityController extends Controller {
|
||||||
const history = new ProfileAbilityHistory();
|
const history = new ProfileAbilityHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAbilityId = abilityId;
|
history.profileAbilityId = abilityId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ export class ProfileAbilityEmployeeController extends Controller {
|
||||||
const history = new ProfileAbilityHistory();
|
const history = new ProfileAbilityHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAbilityId = abilityId;
|
history.profileAbilityId = abilityId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
const history = new ProfileAbilityHistory();
|
const history = new ProfileAbilityHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAbilityId = abilityId;
|
history.profileAbilityId = abilityId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ export class ProfileAddressController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
@ -66,7 +65,6 @@ export class ProfileAddressController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!getProfileAddress) {
|
if (!getProfileAddress) {
|
||||||
|
|
@ -88,12 +86,32 @@ export class ProfileAddressController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileId: profile.id },
|
where: { profileId: profile.id },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -109,12 +127,32 @@ export class ProfileAddressController extends Controller {
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileId: profileId },
|
where: { profileId: profileId },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -135,7 +173,7 @@ export class ProfileAddressController extends Controller {
|
||||||
const history = new ProfileAddressHistory();
|
const history = new ProfileAddressHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileId = profileId;
|
history.profileId = profileId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ export class ProfileAddressEmployeeController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
@ -70,7 +69,6 @@ export class ProfileAddressEmployeeController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!getProfileAddress) {
|
if (!getProfileAddress) {
|
||||||
|
|
@ -92,12 +90,32 @@ export class ProfileAddressEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,12 +131,32 @@ export class ProfileAddressEmployeeController extends Controller {
|
||||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profileId },
|
where: { profileEmployeeId: profileId },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,7 +177,7 @@ export class ProfileAddressEmployeeController extends Controller {
|
||||||
const history = new ProfileAddressHistory();
|
const history = new ProfileAddressHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEmployeeId = profileId;
|
history.profileEmployeeId = profileId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
|
|
@ -70,7 +69,6 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
||||||
"currentDistrictId",
|
"currentDistrictId",
|
||||||
"currentSubDistrictId",
|
"currentSubDistrictId",
|
||||||
"currentZipCode",
|
"currentZipCode",
|
||||||
"createdAt",
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!getProfileAddress) {
|
if (!getProfileAddress) {
|
||||||
|
|
@ -92,12 +90,32 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profile.id },
|
where: { profileEmployeeId: profile.id },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,12 +131,32 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
||||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||||
const record = await this.profileAddressHistoryRepo.find({
|
const record = await this.profileAddressHistoryRepo.find({
|
||||||
where: { profileEmployeeId: profileId },
|
where: { profileEmployeeId: profileId },
|
||||||
order: { createdAt: "DESC" },
|
relations: [
|
||||||
|
"registrationProvince",
|
||||||
|
"registrationDistrict",
|
||||||
|
"registrationSubDistrict",
|
||||||
|
"currentProvince",
|
||||||
|
"currentDistrict",
|
||||||
|
"currentSubDistrict",
|
||||||
|
],
|
||||||
|
order: { createdAt: "ASC" },
|
||||||
});
|
});
|
||||||
if (!record) {
|
const _record = record.map((item) => ({
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
id: item.id,
|
||||||
}
|
currentAddress: item.currentAddress,
|
||||||
return new HttpSuccess(record);
|
registrationAddress: item.registrationAddress,
|
||||||
|
currentZipCode: item.currentZipCode,
|
||||||
|
registrationZipCode: item.registrationZipCode,
|
||||||
|
currentProvince: item.currentProvince?.name ?? null,
|
||||||
|
registrationProvince: item.registrationProvince?.name ?? null,
|
||||||
|
currentDistrict: item.currentDistrict?.name ?? null,
|
||||||
|
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||||
|
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||||
|
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
}));
|
||||||
|
return new HttpSuccess(_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,7 +177,7 @@ export class ProfileAddressEmployeeTempController extends Controller {
|
||||||
const history = new ProfileAddressHistory();
|
const history = new ProfileAddressHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEmployeeId = profileId;
|
history.profileEmployeeId = profileId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export class ProfileAssessmentsController extends Controller {
|
||||||
const history = new ProfileAssessmentHistory();
|
const history = new ProfileAssessmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAssessmentId = assessmentId;
|
history.profileAssessmentId = assessmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ export class ProfileAssessmentsEmployeeController extends Controller {
|
||||||
const history = new ProfileAssessmentHistory();
|
const history = new ProfileAssessmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAssessmentId = assessmentId;
|
history.profileAssessmentId = assessmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export class ProfileAssessmentsEmployeeTempController extends Controller {
|
||||||
const history = new ProfileAssessmentHistory();
|
const history = new ProfileAssessmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileAssessmentId = assessmentId;
|
history.profileAssessmentId = assessmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ export class ProfileCertificateController extends Controller {
|
||||||
const history = new ProfileCertificateHistory();
|
const history = new ProfileCertificateHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileCertificateId = certificateId;
|
history.profileCertificateId = certificateId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ export class ProfileCertificateEmployeeController extends Controller {
|
||||||
const history = new ProfileCertificateHistory();
|
const history = new ProfileCertificateHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileCertificateId = certificateId;
|
history.profileCertificateId = certificateId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
||||||
const history = new ProfileCertificateHistory();
|
const history = new ProfileCertificateHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileCertificateId = certificateId;
|
history.profileCertificateId = certificateId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export class ProfileChangeNameController extends Controller {
|
||||||
const history = new ProfileChangeNameHistory();
|
const history = new ProfileChangeNameHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileChangeNameId = changeNameId;
|
history.profileChangeNameId = changeNameId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ export class ProfileChangeNameEmployeeController extends Controller {
|
||||||
const history = new ProfileChangeNameHistory();
|
const history = new ProfileChangeNameHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileChangeNameId = changeNameId;
|
history.profileChangeNameId = changeNameId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller {
|
||||||
const history = new ProfileChangeNameHistory();
|
const history = new ProfileChangeNameHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileChangeNameId = changeNameId;
|
history.profileChangeNameId = changeNameId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export class ProfileChildrenController extends Controller {
|
||||||
|
|
||||||
const history = new ProfileChildrenHistory();
|
const history = new ProfileChildrenHistory();
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
||||||
history.profileChildrenId = record.id;
|
history.profileChildrenId = record.id;
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ export class ProfileChildrenEmployeeController extends Controller {
|
||||||
|
|
||||||
const history = new ProfileChildrenHistory();
|
const history = new ProfileChildrenHistory();
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
||||||
history.profileChildrenId = record.id;
|
history.profileChildrenId = record.id;
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export class ProfileChildrenEmployeeTempController extends Controller {
|
||||||
|
|
||||||
const history = new ProfileChildrenHistory();
|
const history = new ProfileChildrenHistory();
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
|
||||||
history.profileChildrenId = record.id;
|
history.profileChildrenId = record.id;
|
||||||
|
|
|
||||||
|
|
@ -2388,6 +2388,12 @@ export class ProfileController extends Controller {
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
|
||||||
|
|
||||||
|
Object.assign(record, body);
|
||||||
|
record.lastUpdateUserId = request.user.sub;
|
||||||
|
record.lastUpdateFullName = request.user.name;
|
||||||
|
record.lastUpdatedAt = new Date();
|
||||||
|
record.dateRetire = calculateRetireDate(record.birthDate);
|
||||||
|
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
||||||
await this.profileHistoryRepo.save(
|
await this.profileHistoryRepo.save(
|
||||||
Object.assign(new ProfileHistory(), {
|
Object.assign(new ProfileHistory(), {
|
||||||
...record,
|
...record,
|
||||||
|
|
@ -2395,13 +2401,6 @@ export class ProfileController extends Controller {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.assign(record, body);
|
|
||||||
record.lastUpdateUserId = request.user.sub;
|
|
||||||
record.lastUpdateFullName = request.user.name;
|
|
||||||
record.lastUpdatedAt = new Date();
|
|
||||||
record.dateRetire = calculateRetireDate(record.birthDate);
|
|
||||||
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
|
|
||||||
await this.profileRepo.save(record);
|
await this.profileRepo.save(record);
|
||||||
|
|
||||||
if (record != null && record.keycloak != null) {
|
if (record != null && record.keycloak != null) {
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ export class ProfileDevelopmentController extends Controller {
|
||||||
const history = new ProfileDevelopmentHistory();
|
const history = new ProfileDevelopmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDevelopmentId = developmentId;
|
history.profileDevelopmentId = developmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
||||||
const history = new ProfileDevelopmentHistory();
|
const history = new ProfileDevelopmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDevelopmentId = developmentId;
|
history.profileDevelopmentId = developmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
|
||||||
const history = new ProfileDevelopmentHistory();
|
const history = new ProfileDevelopmentHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDevelopmentId = developmentId;
|
history.profileDevelopmentId = developmentId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ export class ProfileDisciplineController extends Controller {
|
||||||
const history = new ProfileDisciplineHistory();
|
const history = new ProfileDisciplineHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDisciplineId = disciplineId;
|
history.profileDisciplineId = disciplineId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
||||||
const history = new ProfileDisciplineHistory();
|
const history = new ProfileDisciplineHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDisciplineId = disciplineId;
|
history.profileDisciplineId = disciplineId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
||||||
const history = new ProfileDisciplineHistory();
|
const history = new ProfileDisciplineHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDisciplineId = disciplineId;
|
history.profileDisciplineId = disciplineId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export class ProfileDutyController extends Controller {
|
||||||
const history = new ProfileDutyHistory();
|
const history = new ProfileDutyHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDutyId = dutyId;
|
history.profileDutyId = dutyId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileDutyEmployeeController extends Controller {
|
||||||
const history = new ProfileDutyHistory();
|
const history = new ProfileDutyHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDutyId = dutyId;
|
history.profileDutyId = dutyId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
||||||
const history = new ProfileDutyHistory();
|
const history = new ProfileDutyHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileDutyId = dutyId;
|
history.profileDutyId = dutyId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export class ProfileEducationsController extends Controller {
|
||||||
const history = new ProfileEducationHistory();
|
const history = new ProfileEducationHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEducationId = educationId;
|
history.profileEducationId = educationId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ export class ProfileEducationsEmployeeController extends Controller {
|
||||||
const history = new ProfileEducationHistory();
|
const history = new ProfileEducationHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEducationId = educationId;
|
history.profileEducationId = educationId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
||||||
const history = new ProfileEducationHistory();
|
const history = new ProfileEducationHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEducationId = educationId;
|
history.profileEducationId = educationId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -1234,6 +1234,12 @@ export class ProfileEmployeeController extends Controller {
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
if (!findRevision) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||||
|
}
|
||||||
const data = await Promise.all(
|
const data = await Promise.all(
|
||||||
record.map((_data) => {
|
record.map((_data) => {
|
||||||
const shortName =
|
const shortName =
|
||||||
|
|
@ -1256,6 +1262,45 @@ export class ProfileEmployeeController extends Controller {
|
||||||
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
: _data.profileEmployeeEmployment.reduce((latest, current) => {
|
||||||
return latest.date > current.date ? latest : current;
|
return latest.date > current.date ? latest : current;
|
||||||
}).date;
|
}).date;
|
||||||
|
const root =
|
||||||
|
_data.current_holders.length == 0 ||
|
||||||
|
(_data.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||||
|
_data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null)
|
||||||
|
? null
|
||||||
|
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||||
|
|
||||||
|
const child1 =
|
||||||
|
_data.current_holders == null ||
|
||||||
|
_data.current_holders.length == 0 ||
|
||||||
|
_data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1;
|
||||||
|
|
||||||
|
const child2 =
|
||||||
|
_data.current_holders == null ||
|
||||||
|
_data.current_holders.length == 0 ||
|
||||||
|
_data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2;
|
||||||
|
|
||||||
|
const child3 =
|
||||||
|
_data.current_holders == null ||
|
||||||
|
_data.current_holders.length == 0 ||
|
||||||
|
_data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3;
|
||||||
|
|
||||||
|
const child4 =
|
||||||
|
_data.current_holders == null ||
|
||||||
|
_data.current_holders.length == 0 ||
|
||||||
|
_data.current_holders.find((x) => x.orgRevisionId == findRevision.id) == null
|
||||||
|
? null
|
||||||
|
: _data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4;
|
||||||
|
|
||||||
|
let _child1 = child1 == null ? "" : `${child1.orgChild1Name}/`;
|
||||||
|
let _child2 = child2 == null ? "" : `${child2.orgChild2Name}/`;
|
||||||
|
let _child3 = child3 == null ? "" : `${child3.orgChild3Name}/`;
|
||||||
|
let _child4 = child4 == null ? "" : `${child4.orgChild4Name}/`;
|
||||||
return {
|
return {
|
||||||
id: _data.id,
|
id: _data.id,
|
||||||
prefix: _data.prefix,
|
prefix: _data.prefix,
|
||||||
|
|
@ -1335,6 +1380,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
child4: _data.child4Temp ? _data.child4Temp : null,
|
child4: _data.child4Temp ? _data.child4Temp : null,
|
||||||
child4Id: _data.child4IdTemp ? _data.child4IdTemp : null,
|
child4Id: _data.child4IdTemp ? _data.child4IdTemp : null,
|
||||||
child4ShortName: _data.child4ShortNameTemp ? _data.child4ShortNameTemp : null,
|
child4ShortName: _data.child4ShortNameTemp ? _data.child4ShortNameTemp : null,
|
||||||
|
org: `${_child4}${_child3}${_child2}${_child1}${root?.orgRootName ?? ""}`,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3144,8 +3144,8 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!employment) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
||||||
const history = new ProfileEmployeeEmploymentHistory();
|
const history = new ProfileEmployeeEmploymentHistory();
|
||||||
Object.assign(history, { ...employment, id: undefined });
|
|
||||||
Object.assign(employment, body);
|
Object.assign(employment, body);
|
||||||
|
Object.assign(history, { ...employment, id: undefined });
|
||||||
|
|
||||||
employment.lastUpdateUserId = request.user.sub;
|
employment.lastUpdateUserId = request.user.sub;
|
||||||
employment.lastUpdateFullName = request.user.name;
|
employment.lastUpdateFullName = request.user.name;
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
const history = new ProfileGovernment();
|
const history = new ProfileGovernment();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileId = profileId;
|
history.profileId = profileId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
const history = new ProfileGovernment();
|
const history = new ProfileGovernment();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEmployeeId = profileEmployeeId;
|
history.profileEmployeeId = profileEmployeeId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
||||||
const history = new ProfileGovernment();
|
const history = new ProfileGovernment();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileEmployeeId = profileEmployeeId;
|
history.profileEmployeeId = profileEmployeeId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export class ProfileHonorController extends Controller {
|
||||||
const history = new ProfileHonorHistory();
|
const history = new ProfileHonorHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileHonorId = honorId;
|
history.profileHonorId = honorId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ export class ProfileHonorEmployeeController extends Controller {
|
||||||
const history = new ProfileHonorHistory();
|
const history = new ProfileHonorHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileHonorId = honorId;
|
history.profileHonorId = honorId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
||||||
const history = new ProfileHonorHistory();
|
const history = new ProfileHonorHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileHonorId = honorId;
|
history.profileHonorId = honorId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ export class ProfileInsigniaController extends Controller {
|
||||||
const history = new ProfileInsigniaHistory();
|
const history = new ProfileInsigniaHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileInsigniaId = insigniaId;
|
history.profileInsigniaId = insigniaId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
||||||
const history = new ProfileInsigniaHistory();
|
const history = new ProfileInsigniaHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileInsigniaId = insigniaId;
|
history.profileInsigniaId = insigniaId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
||||||
const history = new ProfileInsigniaHistory();
|
const history = new ProfileInsigniaHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileInsigniaId = insigniaId;
|
history.profileInsigniaId = insigniaId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ export class ProfileLeaveController extends Controller {
|
||||||
const history = new ProfileLeaveHistory();
|
const history = new ProfileLeaveHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileLeaveId = leaveId;
|
history.profileLeaveId = leaveId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ export class ProfileLeaveEmployeeController extends Controller {
|
||||||
const history = new ProfileLeaveHistory();
|
const history = new ProfileLeaveHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileLeaveId = leaveId;
|
history.profileLeaveId = leaveId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ export class ProfileLeaveEmployeeTempController extends Controller {
|
||||||
const history = new ProfileLeaveHistory();
|
const history = new ProfileLeaveHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileLeaveId = leaveId;
|
history.profileLeaveId = leaveId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export class ProfileNopaidController extends Controller {
|
||||||
const history = new ProfileNopaidHistory();
|
const history = new ProfileNopaidHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileNopaidId = nopaidId;
|
history.profileNopaidId = nopaidId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileNopaidEmployeeController extends Controller {
|
||||||
const history = new ProfileNopaidHistory();
|
const history = new ProfileNopaidHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileNopaidId = nopaidId;
|
history.profileNopaidId = nopaidId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
||||||
const history = new ProfileNopaidHistory();
|
const history = new ProfileNopaidHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileNopaidId = nopaidId;
|
history.profileNopaidId = nopaidId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export class ProfileOtherController extends Controller {
|
||||||
const history = new ProfileOtherHistory();
|
const history = new ProfileOtherHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileOtherId = otherId;
|
history.profileOtherId = otherId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
||||||
const history = new ProfileOtherHistory();
|
const history = new ProfileOtherHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileOtherId = otherId;
|
history.profileOtherId = otherId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ export class ProfileOtherEmployeeTempController extends Controller {
|
||||||
const history = new ProfileOtherHistory();
|
const history = new ProfileOtherHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileOtherId = otherId;
|
history.profileOtherId = otherId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export class ProfileSalaryController extends Controller {
|
||||||
const history = new ProfileSalaryHistory();
|
const history = new ProfileSalaryHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileSalaryId = salaryId;
|
history.profileSalaryId = salaryId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export class ProfileSalaryEmployeeController extends Controller {
|
||||||
const history = new ProfileSalaryHistory();
|
const history = new ProfileSalaryHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileSalaryId = salaryId;
|
history.profileSalaryId = salaryId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
||||||
const history = new ProfileSalaryHistory();
|
const history = new ProfileSalaryHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileSalaryId = salaryId;
|
history.profileSalaryId = salaryId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ export class ProfileTrainingController extends Controller {
|
||||||
const history = new ProfileTrainingHistory();
|
const history = new ProfileTrainingHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileTrainingId = trainingId;
|
history.profileTrainingId = trainingId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ export class ProfileTrainingEmployeeController extends Controller {
|
||||||
const history = new ProfileTrainingHistory();
|
const history = new ProfileTrainingHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileTrainingId = trainingId;
|
history.profileTrainingId = trainingId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ export class ProfileTrainingEmployeeTempController extends Controller {
|
||||||
const history = new ProfileTrainingHistory();
|
const history = new ProfileTrainingHistory();
|
||||||
|
|
||||||
Object.assign(record, body);
|
Object.assign(record, body);
|
||||||
Object.assign(history, { ...body, id: undefined });
|
Object.assign(history, { ...record, id: undefined });
|
||||||
|
|
||||||
history.profileTrainingId = trainingId;
|
history.profileTrainingId = trainingId;
|
||||||
record.lastUpdateUserId = req.user.sub;
|
record.lastUpdateUserId = req.user.sub;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue