This commit is contained in:
2021-06-09 00:00:57 +00:00
parent dd21185cdd
commit fb259d41b3
5 changed files with 14 additions and 12 deletions

View File

@@ -96,7 +96,7 @@ namespace AyaNova.Biz
if (deliverAfter < DateTime.UtcNow)
{
if (Subscription.DeliveryMethod == NotifyDeliveryMethod.App)
await DeliverInApp(notifyevent, ct);
await DeliverInApp(notifyevent, Subscription.AgeValue, ct);
else if (Subscription.DeliveryMethod == NotifyDeliveryMethod.SMTP)
await DeliverSMTP(notifyevent, Subscription.DeliveryAddress, ct);
}
@@ -117,10 +117,10 @@ namespace AyaNova.Biz
}
private static async Task DeliverInApp(NotifyEvent ne, AyContext ct)
private static async Task DeliverInApp(NotifyEvent ne, TimeSpan ageValue, AyContext ct)
{
log.LogTrace($"DeliverInApp notify event: {ne}");
await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name });
await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name, AgeValue = ageValue });
await ct.SaveChangesAsync();
ct.NotifyEvent.Remove(ne);
await ct.SaveChangesAsync();