log
This commit is contained in:
parent
ce8bb41bda
commit
0f79425d65
17 changed files with 611 additions and 202 deletions
|
|
@ -32,6 +32,7 @@ import { EmployeePosType } from "../entities/EmployeePosType";
|
|||
import { SalaryEmployee } from "../entities/SalaryEmployee";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/salary/formula")
|
||||
@Tags("SalaryFormula")
|
||||
|
|
@ -98,12 +99,14 @@ export class SalaryFormulaEmployeeController extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
const before = null;
|
||||
formula.salaryEmployeeMins = chkSalaryEmployeeMin;
|
||||
formula.createdUserId = request.user.sub;
|
||||
formula.createdFullName = request.user.name;
|
||||
formula.lastUpdateUserId = request.user.sub;
|
||||
formula.lastUpdateFullName = request.user.name;
|
||||
await this.salaryFormulaEmployeeRepository.save(formula);
|
||||
await this.salaryFormulaEmployeeRepository.save(formula, { data: request });
|
||||
setLogDataDiff(request, { before, after: formula });
|
||||
return new HttpSuccess(formula);
|
||||
}
|
||||
|
||||
|
|
@ -160,6 +163,7 @@ export class SalaryFormulaEmployeeController extends Controller {
|
|||
id: In(requestBody.salaryEmployeeMinIds),
|
||||
},
|
||||
});
|
||||
const before = structuredClone(formula);
|
||||
formula.position = requestBody.position;
|
||||
formula.salaryMin = requestBody.salaryMin;
|
||||
formula.salary = requestBody.salary;
|
||||
|
|
@ -171,7 +175,8 @@ export class SalaryFormulaEmployeeController extends Controller {
|
|||
formula.salaryEmployeeMins = chkSalaryEmployeeMin;
|
||||
formula.lastUpdateUserId = request.user.sub;
|
||||
formula.lastUpdateFullName = request.user.name;
|
||||
await this.salaryFormulaEmployeeRepository.save(formula);
|
||||
await this.salaryFormulaEmployeeRepository.save(formula, { data: request });
|
||||
setLogDataDiff(request, { before, after: formula });
|
||||
return new HttpSuccess(formula.id);
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +192,7 @@ export class SalaryFormulaEmployeeController extends Controller {
|
|||
const delFormula = await this.salaryFormulaEmployeeRepository.findOne({ where: { id } });
|
||||
if (!delFormula) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผังค่าจ้างนี้");
|
||||
|
||||
await this.salaryFormulaEmployeeRepository.remove(delFormula);
|
||||
await this.salaryFormulaEmployeeRepository.remove(delFormula, { data: request });
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue