This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
@@ -133,21 +134,21 @@ namespace AyaNova.Api.Controllers
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
}
|
||||
|
||||
var ret = await ct.NotifyEvent.AsNoTracking().Include(z => z.NotifySubscription).Include(z=>z.User).Select(z => new
|
||||
var ret = new List<NotifyEventQueueItem>();
|
||||
var NotifyEvents = await ct.NotifyEvent.AsNoTracking().ToListAsync();
|
||||
foreach (NotifyEvent ne in NotifyEvents)
|
||||
{
|
||||
z.Id,
|
||||
z.Created,
|
||||
z.EventDate,
|
||||
DeliverAfter = (z.EventDate + z.NotifySubscription.AgeValue - z.NotifySubscription.AdvanceNotice),
|
||||
z.UserId,
|
||||
user=z.User.Name,
|
||||
z.EventType,
|
||||
z.AyaType,
|
||||
z.Name
|
||||
}).ToListAsync();
|
||||
var UserInfo = await ct.User.AsNoTracking().Where(x => x.Id == ne.UserId).Select(x => new { Active = x.Active, Name = x.Name }).FirstOrDefaultAsync();
|
||||
var Subscription = await ct.NotifySubscription.AsNoTracking().FirstOrDefaultAsync(x => x.Id == ne.NotifySubscriptionId);
|
||||
|
||||
ret.Add(new NotifyEventQueueItem(ne.Id, ne.Created, ne.EventDate, (ne.EventDate + Subscription.AgeValue - Subscription.AdvanceNotice), ne.UserId, UserInfo.Name, ne.EventType, ne.AyaType, ne.Name));
|
||||
}
|
||||
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
public record NotifyEventQueueItem(long Id, DateTime Created, DateTime EventDate, DateTime DeliverAfter, long UserId, string User, NotifyEventType EventType, AyaType AyaType, string Name);
|
||||
|
||||
/// <summary>
|
||||
/// Delete pending notification event
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user