แก้บั้กออกคำสั่ง + ใส่ Payload ใน inbox + noti
This commit is contained in:
parent
e451149b2f
commit
356fcba76a
9 changed files with 785 additions and 222 deletions
|
|
@ -1,9 +1,13 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Application.Responses.Messages;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Notifications;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.MessageQueue
|
||||
{
|
||||
|
|
@ -29,7 +33,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<List<Inbox>> GetMyInboxAsync()
|
||||
public async Task<List<InboxResponse>> GetMyInboxAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -44,6 +48,17 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
var data = await _dbContext.Set<Inbox>()
|
||||
.Where(x => x.ReceiverUserId == profile.Id)
|
||||
.OrderByDescending(x => x.ReceiveDate)
|
||||
.Select(x => new InboxResponse
|
||||
{
|
||||
Subject = x.Subject,
|
||||
Body = x.Body,
|
||||
ReceiverUserId = x.ReceiverUserId,
|
||||
IsOpen = x.IsOpen,
|
||||
ReceiveDate = x.ReceiveDate,
|
||||
OpenDate = x.OpenDate,
|
||||
Payload = x.Payload == "" ? null : JsonConvert.DeserializeObject<CommandPayload>(Regex.Unescape(x.Payload))
|
||||
})
|
||||
.Take(20)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue