เก็บประวัติ isupload
This commit is contained in:
parent
d249e94cb5
commit
7eea4cd33c
24 changed files with 146 additions and 135 deletions
|
|
@ -164,12 +164,12 @@ export class ProfileAbilityController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAbilityRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAbilityRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,12 +173,12 @@ export class ProfileAbilityEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAbilityRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAbilityRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,12 +163,12 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAbilityRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAbilityRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAbilityHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,12 +165,12 @@ export class ProfileAssistanceController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAssistanceRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAssistanceRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,12 +173,12 @@ export class ProfileAssistanceEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAssistanceRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAssistanceRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,12 +163,12 @@ export class ProfileAssistanceEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.profileAssistanceRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.profileAssistanceRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.profileAssistanceHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,12 +156,12 @@ export class ProfileCertificateController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.certificateRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.certificateHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.certificateRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.certificateHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,12 +164,12 @@ export class ProfileCertificateEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.certificateRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.certificateHistoryRepo.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.certificateRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.certificateHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,12 +152,12 @@ export class ProfileCertificateEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.certificateRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.certificateHistoryRepo.save(history, { data: req }),
|
||||
setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.certificateRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.certificateHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,12 +163,14 @@ export class ProfileDisciplineController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.disciplineRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.disciplineHistoryRepository.save(history, { data: req }),
|
||||
setLogDataDiff(req, { before, after: history }),
|
||||
]);
|
||||
// await Promise.all(
|
||||
this.disciplineRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.disciplineHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
// );
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,12 +169,12 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.disciplineRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.disciplineHistoryRepository.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.disciplineRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.disciplineHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,12 +159,12 @@ export class ProfileDisciplineEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.disciplineRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.disciplineHistoryRepository.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.disciplineRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.disciplineHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ export class ProfileDutyController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.dutyRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.dutyHistoryRepository.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.dutyRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.dutyHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,12 +149,12 @@ export class ProfileDutyEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.dutyRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.dutyHistoryRepository.save(history, { data: req }),
|
||||
setLogDataDiff(req, { before, after: history }),
|
||||
]);
|
||||
this.dutyRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.dutyHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,12 +138,12 @@ export class ProfileDutyEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.dutyRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.dutyHistoryRepository.save(history, { data: req }),
|
||||
// setLogDataDiff(req, { before: before_null, after: history }),
|
||||
]);
|
||||
this.dutyRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.dutyHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,11 +166,12 @@ export class ProfileHonorController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.honorRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.honorHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.honorRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.honorHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,11 +178,12 @@ export class ProfileHonorEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.honorRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.honorHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.honorRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.honorHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,11 +166,12 @@ export class ProfileHonorEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.honorRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.honorHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.honorRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.honorHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,11 +186,12 @@ export class ProfileInsigniaController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.insigniaRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.insigniaHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.insigniaRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.insigniaHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,11 +197,12 @@ export class ProfileInsigniaEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.insigniaRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.insigniaHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.insigniaRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.insigniaHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,11 +186,12 @@ export class ProfileInsigniaEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.insigniaRepo.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.insigniaHistoryRepo.save(history, { data: req }),
|
||||
]);
|
||||
this.insigniaRepo.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.insigniaHistoryRepo.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,11 +130,12 @@ export class ProfileNopaidController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.nopaidRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.nopaidHistoryRepository.save(history, { data: req }),
|
||||
]);
|
||||
this.nopaidRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.nopaidHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,11 +137,12 @@ export class ProfileNopaidEmployeeController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.nopaidRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.nopaidHistoryRepository.save(history, { data: req }),
|
||||
]);
|
||||
this.nopaidRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.nopaidHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,11 +134,12 @@ export class ProfileNopaidEmployeeTempController extends Controller {
|
|||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.nopaidRepository.save(record, { data: req }),
|
||||
setLogDataDiff(req, { before, after: record }),
|
||||
this.nopaidHistoryRepository.save(history, { data: req }),
|
||||
]);
|
||||
this.nopaidRepository.save(record, { data: req });
|
||||
setLogDataDiff(req, { before, after: record });
|
||||
if (!(Object.keys(body).length === 1 && body.isUpload)) {
|
||||
this.nopaidHistoryRepository.save(history, { data: req });
|
||||
// setLogDataDiff(req, { before, after: history });
|
||||
}
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue