เพิ่มnoti by keycloak
This commit is contained in:
parent
ef415217c8
commit
356c6eb9c0
2 changed files with 56 additions and 0 deletions
|
|
@ -72,6 +72,47 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
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")]
|
[HttpPost("cronjob")]
|
||||||
public async Task<ActionResult<ResponseObject>> CornjobProbation([FromBody] NotiCronjobProbationRequest req)
|
public async Task<ActionResult<ResponseObject>> CornjobProbation([FromBody] NotiCronjobProbationRequest req)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
15
BMA.EHR.Placement.Service/Requests/NotiReplyRequest.cs
Normal file
15
BMA.EHR.Placement.Service/Requests/NotiReplyRequest.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Placement.Service.Requests
|
||||||
|
{
|
||||||
|
public class NotiReplyRequest
|
||||||
|
{
|
||||||
|
public string Subject { get; set; } = "";
|
||||||
|
public string Body { get; set; } = "";
|
||||||
|
public string Payload { get; set; } = "";
|
||||||
|
public bool IsSendMail { get; set; } = true;
|
||||||
|
public bool IsSendInbox { get; set; } = true;
|
||||||
|
public bool IsSendNotification { get; set; } = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue