แก้คำสั่งบรรจุ

This commit is contained in:
Kittapath 2024-07-01 01:30:24 +07:00
parent 7c0b7f1aa7
commit 2678b7fc59
8 changed files with 18664 additions and 44 deletions

View file

@ -62,9 +62,9 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUser([FromBody] NotiRequest req)
{
var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.Id == req.ReceiverUserId);
if (profile == null)
return Error(GlobalMessages.DataNotFound);
// var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.Id == req.ReceiverUserId);
// if (profile == null)
// return Error(GlobalMessages.DataNotFound);
await _repositoryNoti.PushNotificationAsync(
req.ReceiverUserId,
@ -116,18 +116,32 @@ namespace BMA.EHR.Placement.Service.Controllers
var inbox = await _context.Inboxes.FirstOrDefaultAsync(x => x.Id == id);
if (inbox == null)
return Error(GlobalMessages.DataNotFound);
var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(inbox.CreatedUserId));
if (profile == null)
return Error(GlobalMessages.DataNotFound);
await _repositoryNoti.PushNotificationAsync(
profile.Id,
req.Subject,
req.Body,
req.Payload,
req.IsSendInbox,
req.IsSendMail
);
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position/{inbox.CreatedUserId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org != null && org.result != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(org.result.id),
req.Subject,
req.Body,
req.Payload,
req.IsSendInbox,
req.IsSendMail
);
}
return Success();
}
// var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(inbox.CreatedUserId));
// if (profile == null)
// return Error(GlobalMessages.DataNotFound);
return Success();
}
@ -135,9 +149,9 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost("cronjob")]
public async Task<ActionResult<ResponseObject>> CornjobProbation([FromBody] NotiCronjobProbationRequest req)
{
var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.Id == req.ReceiverUserId);
if (profile == null)
return Error(GlobalMessages.DataNotFound);
// var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.Id == req.ReceiverUserId);
// if (profile == null)
// return Error(GlobalMessages.DataNotFound);
_context.CronjobNotiProbations.Add(new CronjobNotiProbation
{