เพิ่ม List ของการเจ้หน้าที่ ส่ง noti ขอยกเลิกการลา #2432
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m52s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m52s
This commit is contained in:
parent
c34fe35506
commit
6efeec3f1f
2 changed files with 30 additions and 0 deletions
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ";
|
public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ";
|
||||||
|
|
||||||
|
public static readonly string ProfileNotFound = "ไม่พบข้อมูลในระบบทะเบียนประวัติ";
|
||||||
|
|
||||||
public static readonly string NotAuthorized = "กรุณาเข้าสู่ระบบก่อนใช้งาน!";
|
public static readonly string NotAuthorized = "กรุณาเข้าสู่ระบบก่อนใช้งาน!";
|
||||||
|
|
||||||
public static readonly string ForbiddenAccess = "คุณไม่ได้รับอนุญาติให้เข้าใช้งาน!";
|
public static readonly string ForbiddenAccess = "คุณไม่ได้รับอนุญาติให้เข้าใช้งาน!";
|
||||||
|
|
|
||||||
|
|
@ -1876,6 +1876,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(data.KeycloakUserId, AccessToken);
|
||||||
|
if (profile == null)
|
||||||
|
{
|
||||||
|
return Error(GlobalMessages.ProfileNotFound, StatusCodes.Status404NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
// change status to delete
|
// change status to delete
|
||||||
// แก้จาก DELETE เป็น DELETING ไว้ก่อน รอ approve ค่อยเปลี่ยนเป็น DELETE
|
// แก้จาก DELETE เป็น DELETING ไว้ก่อน รอ approve ค่อยเปลี่ยนเป็น DELETE
|
||||||
// data.LeaveStatus = "DELETE";
|
// data.LeaveStatus = "DELETE";
|
||||||
|
|
@ -1929,6 +1935,28 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
_appDbContext.Set<Notification>().Add(noti1);
|
_appDbContext.Set<Notification>().Add(noti1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get Officer List
|
||||||
|
var officers = await _userProfileRepository.GetOCStaffAsync(profile.Id, AccessToken);
|
||||||
|
var approverProfileIdList = approvers.Select(x => x.ProfileId).ToList();
|
||||||
|
|
||||||
|
if(officers != null && officers.Count > 0)
|
||||||
|
{
|
||||||
|
officers = officers.Where(x => !approverProfileIdList.Contains(x.ProfileId)).ToList();
|
||||||
|
foreach (var officer in officers)
|
||||||
|
{
|
||||||
|
// Send Notification
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"คำร้องขอยกเลิกการลาของคุณ {data.FirstName} {data.LastName} รอรับการอนุมัติจากคุณ",
|
||||||
|
ReceiverUserId = officer.ProfileId,
|
||||||
|
Type = "",
|
||||||
|
Payload = $"{URL}/leave/detail/{id}",
|
||||||
|
};
|
||||||
|
_appDbContext.Set<Notification>().Add(noti);
|
||||||
|
}
|
||||||
|
await _appDbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue