From 06db1a6c684145cb51a7d05a37b5435839161269 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Fri, 17 May 2024 11:03:27 +0700 Subject: [PATCH] fix swap direction --- src/controllers/ProfileSalaryEmployeeController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index ceeb0110..00cd4d54 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -133,7 +133,7 @@ export class ProfileSalaryEmployeeController extends Controller { const sourceOrder = source_item.order; if (direction.trim().toUpperCase() == "UP") { const dest_item = await this.salaryRepo.findOne({ - where: { profileId: source_item.profileId, order: LessThan(sourceOrder) }, + where: { profileEmployeeId: source_item.profileEmployeeId, order: LessThan(sourceOrder) }, order: { order: "DESC" }, }); if (dest_item == null) return new HttpSuccess(); @@ -143,7 +143,7 @@ export class ProfileSalaryEmployeeController extends Controller { await Promise.all([this.salaryRepo.save(source_item), this.salaryRepo.save(dest_item)]); } else { const dest_item = await this.salaryRepo.findOne({ - where: { profileId: source_item.profileId, order: MoreThan(sourceOrder) }, + where: { profileEmployeeId: source_item.profileEmployeeId, order: MoreThan(sourceOrder) }, order: { order: "ASC" }, }); if (dest_item == null) return new HttpSuccess();