noti report
This commit is contained in:
parent
85d9754db6
commit
037435b3bc
5 changed files with 83 additions and 26 deletions
|
|
@ -62,10 +62,6 @@ 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);
|
||||
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(req.ReceiverUserId),
|
||||
req.Subject,
|
||||
|
|
@ -81,10 +77,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[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);
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/keycloakid/position/" + req.ReceiverUserId;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -112,18 +104,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[HttpPost("profile")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUserProfile([FromBody] NotiRequest req)
|
||||
{
|
||||
// var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == req.ReceiverUserId);
|
||||
// if (profile == null)
|
||||
// return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
// var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/" + req.ReceiverUserId;
|
||||
// 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 (req.ReceiverUserId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
|
|
@ -136,7 +116,20 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
);
|
||||
}
|
||||
return Success();
|
||||
// }
|
||||
}
|
||||
|
||||
[HttpPost("profiles")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePropertyByUserProfiles([FromBody] NotisRequest req)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
req.ReceiverUserIds.Select(x => Guid.Parse(x)).ToArray(),
|
||||
req.Subject,
|
||||
req.Body,
|
||||
req.Payload,
|
||||
req.IsSendInbox,
|
||||
req.IsSendMail
|
||||
);
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpPut("{id:length(36)}")]
|
||||
|
|
@ -170,11 +163,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
return Success();
|
||||
}
|
||||
// var profile = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(inbox.CreatedUserId));
|
||||
// if (profile == null)
|
||||
// return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpPost("cronjob")]
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
Id = x.Id,
|
||||
PersonalId = x.Id,
|
||||
x.profileId,
|
||||
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
||||
Prefix = x.Prefix,
|
||||
|
|
@ -203,6 +204,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.Lastname,
|
||||
p.IdCard,
|
||||
p.CitizenId,
|
||||
p.profileId,
|
||||
p.ExamNumber,
|
||||
p.posmasterId,
|
||||
p.root,
|
||||
|
|
@ -282,6 +284,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
Id = x.Id,
|
||||
PersonalId = x.Id,
|
||||
x.profileId,
|
||||
Avatar = x.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.ProfileImg.Id,
|
||||
FullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
|
||||
Prefix = x.Prefix,
|
||||
|
|
@ -341,6 +344,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.Lastname,
|
||||
p.IdCard,
|
||||
p.CitizenId,
|
||||
p.profileId,
|
||||
p.ExamNumber,
|
||||
p.posmasterId,
|
||||
p.root,
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
{
|
||||
p.Id,
|
||||
p.citizenId,
|
||||
p.profileId,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue