เพิ่มบันทึกเวลาอ่านnoti
This commit is contained in:
parent
78b0ad7d1d
commit
33526755ac
1 changed files with 14 additions and 12 deletions
|
|
@ -54,17 +54,6 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
.Where(x => x.ReceiverUserId == profile.Id)
|
||||
.Where(x => x.DeleteDate == null)
|
||||
.OrderByDescending(x => x.ReceiveDate)
|
||||
.Select(x => new NotificationResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
Body = x.Body,
|
||||
ReceiverUserId = x.ReceiverUserId,
|
||||
IsOpen = x.IsOpen,
|
||||
Type = x.Type,
|
||||
ReceiveDate = x.ReceiveDate,
|
||||
OpenDate = x.OpenDate,
|
||||
Payload = x.Payload == "" ? null : JsonConvert.DeserializeObject<CommandPayload>(Regex.Unescape(x.Payload))
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var data = data_search
|
||||
|
|
@ -76,10 +65,23 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
foreach (var data_open in data_opens)
|
||||
{
|
||||
data_open.IsOpen = true;
|
||||
data_open.OpenDate = DateTime.Now;
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
var _data = new { data, total = data_search.Count(), totalNoti = data_search.Where(x => x.IsOpen == false).Count() };
|
||||
var data2 = data.Select(x => new NotificationResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
Body = x.Body,
|
||||
ReceiverUserId = x.ReceiverUserId,
|
||||
IsOpen = x.IsOpen,
|
||||
Type = x.Type,
|
||||
ReceiveDate = x.ReceiveDate,
|
||||
OpenDate = x.OpenDate,
|
||||
Payload = x.Payload == "" ? null : JsonConvert.DeserializeObject<CommandPayload>(Regex.Unescape(x.Payload))
|
||||
}).ToList();
|
||||
|
||||
var _data = new { data = data2, total = data_search.Count(), totalNoti = data_search.Where(x => x.IsOpen == false).Count() };
|
||||
return _data;
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue