This commit is contained in:
2020-07-17 00:40:41 +00:00
parent c249fd5400
commit c547913d12

View File

@@ -110,11 +110,11 @@ namespace AyaNova.Biz
//then *this* code will go through and look for subscriptions related to that event
//this way the biz object code can be "dumb" about notifications in general and just let this code handle it as needed
//will iterate the subscriptions and see if any apply here
internal static async Task HandlePotentialNotificationEvent(AyaType ayaType, AyaEvent ayaEvent, BizObject newObject, BizObject currentObject)
internal static async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel newObject, ICoreBizObjectModel currentObject)
{
log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{ayaType}, AyaEvent:{ayaEvent}]");
log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{newObject.AyaType}, AyaEvent:{ayaEvent}]");
try
{
@@ -125,7 +125,7 @@ namespace AyaNova.Biz
switch (ayaEvent)
{
case AyaEvent.Created:
switch (ayaType)
switch (newObject.AyaType)
{
//AyaTypes with their own special notification related events
@@ -138,10 +138,10 @@ namespace AyaNova.Biz
}
//ObjectCreated subscriptions
{
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == ayaType).ToListAsync();
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();
foreach (var sub in subs)
{
NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType=ayaType,ObjectId=newObject.id, SubscriptionId = sub.Id };
NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType=newObject.AyaType,ObjectId=newObject.Id, SubscriptionId = sub.Id };
await ct.NotifyEvent.AddAsync(n);
}
if (subs.Count > 0)