api delete noti

This commit is contained in:
Kittapath 2023-09-11 12:02:01 +07:00
parent e451149b2f
commit 2ba9ef84fd
3 changed files with 137 additions and 0 deletions

View file

@ -43,6 +43,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
var data = await _dbContext.Set<Notification>()
.Where(x => x.ReceiverUserId == profile.Id)
.Where(x => x.IsOpen == false)
.OrderByDescending(x => x.ReceiveDate)
.ToListAsync();
@ -54,6 +55,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
}
}
public async Task DeleteMyNotificationAsync(Guid id)
{
try
{
var notification = await _dbContext.Set<Notification>()
.FirstOrDefaultAsync(p => p.Id == id);
if (notification != null)
{
notification.IsOpen = true;
// _dbContext.Set<Notification>().Remove(notification);
await _dbContext.SaveChangesAsync();
}
}
catch
{
throw;
}
}
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, string Payload = "", bool IsSendInbox = false, bool IsSendMail = false)
{
try