fix noti user placement

This commit is contained in:
Kittapath 2023-09-08 11:05:23 +07:00
parent 7f53cf96c4
commit a886825bb1
3 changed files with 23 additions and 5 deletions

View file

@ -352,7 +352,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
}
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"),
Guid.Parse("08db721d-ae2f-4f5d-836a-02d2413df33d"),
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก",
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก"
);
@ -507,6 +507,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync();
return Success();
@ -537,6 +542,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync();
return Success();
@ -567,9 +577,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ"
updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ"
);
await _context.SaveChangesAsync();
@ -589,6 +599,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id)
{
var updated = await _context.RetirementResigns
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
@ -601,6 +613,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ"
);
await _context.SaveChangesAsync();
return Success();