เพิ่มnoti by keycloak

This commit is contained in:
Kittapath 2023-12-24 15:05:44 +07:00
parent ef415217c8
commit 356c6eb9c0
2 changed files with 56 additions and 0 deletions

View file

@ -72,6 +72,47 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
[HttpPost("keycloak")]
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUserKeycloak([FromBody] NotiRequest req)
{
var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == req.ReceiverUserId);
if (profile == null)
return Error(GlobalMessages.DataNotFound);
await _repositoryNoti.PushNotificationAsync(
profile.Id,
req.Subject,
req.Body,
req.Payload,
req.IsSendInbox,
req.IsSendMail
);
return Success();
}
[HttpPut("{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> ReplyPropertyByUser([FromBody] NotiReplyRequest req, Guid id)
{
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
);
return Success();
}
[HttpPost("cronjob")]
public async Task<ActionResult<ResponseObject>> CornjobProbation([FromBody] NotiCronjobProbationRequest req)
{