diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index d59ed83..ff4597b 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -751,13 +751,13 @@ export class SalaryPeriodController extends Controller { * @summary SLR_020 - รายการรอบเงินเดือน #20 * */ - @Get("snapshot/{snaphot}/{salaryPeriodId}") + @Get("snapshot/{snapshot}/{salaryPeriodId}") async SnapshotSalary( - @Path() snaphot: string, + @Path() snapshot: string, salaryPeriodId: string, @Request() request: { user: Record }, ) { - snaphot = snaphot.toLocaleUpperCase(); + snapshot = snapshot.toLocaleUpperCase(); const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId }, }); @@ -766,7 +766,7 @@ export class SalaryPeriodController extends Controller { } const salaryOrg = await this.salaryOrgRepository.find({ - where: { salaryPeriodId: salaryPeriod.id, snapshot: snaphot }, + where: { salaryPeriodId: salaryPeriod.id, snapshot: snapshot }, }); const salaryProfile = await this.salaryProfileRepository.find({ where: { salaryOrgId: In(salaryOrg.map((x) => x.id)) }, @@ -788,7 +788,7 @@ export class SalaryPeriodController extends Controller { salaryOrgNew.status = "PENDING"; salaryOrgNew.rootId = rootId; salaryOrgNew.revisionId = salaryPeriod.revisionId; - salaryOrgNew.snapshot = snaphot; + salaryOrgNew.snapshot = snapshot; salaryOrgNew.group = "GROUP1"; salaryOrgNew.createdUserId = request.user.sub; salaryOrgNew.createdFullName = request.user.name; @@ -802,9 +802,9 @@ export class SalaryPeriodController extends Controller { ); let salaryProfileOld: SalaryProfile[] = []; - if (snaphot == "SNAP2") { + if (snapshot == "SNAP2") { const salaryOrgOld = await this.salaryOrgRepository.findOne({ - where: { salaryPeriodId: salaryPeriod.id, snapshot: snaphot }, + where: { salaryPeriodId: salaryPeriod.id, snapshot: "SNAP1" }, relations: ["salaryProfiles"], }); if (salaryOrgOld != null) salaryProfileOld = salaryOrgOld.salaryProfiles; @@ -827,7 +827,7 @@ export class SalaryPeriodController extends Controller { where: { salaryPeriodId: salaryPeriod.id, rootId: profile.rootId, - snapshot: snaphot, + snapshot: snapshot, group: group, }, }); @@ -841,7 +841,7 @@ export class SalaryPeriodController extends Controller { salaryProfileNew.lastUpdateUserId = request.user.sub; salaryProfileNew.lastUpdateFullName = request.user.name; - if (snaphot == "SNAP2") { + if (snapshot == "SNAP2") { const salaryOld = salaryProfileOld.find( (x) => x.citizenId == salaryProfileNew.citizenId, ); @@ -857,7 +857,7 @@ export class SalaryPeriodController extends Controller { ); const salaryOrgNew = await this.salaryOrgRepository.find({ - where: { salaryPeriodId: salaryPeriod.id, snapshot: snaphot }, + where: { salaryPeriodId: salaryPeriod.id, snapshot: snapshot }, relations: ["salaryProfiles"], }); await Promise.all(