diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index 794ecfaa..e3a6af5f 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -117,7 +117,7 @@ namespace AyaNova.Biz log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{ayaType}, AyaEvent:{ayaEvent}]"); try { - // var HasTags = inTags != null && inTags.Count > 0; + using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext) { @@ -125,8 +125,33 @@ namespace AyaNova.Biz switch (ayaEvent) { case AyaEvent.Created: + switch (ayaType) + { + //AyaTypes with their own special notification related events + + + case AyaType.WorkOrder: + break; + case AyaType.Quote: + break; + + } + //ObjectCreated subscriptions + { + var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == 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 }; + await ct.NotifyEvent.AddAsync(n); + } + if (subs.Count > 0) + await ct.SaveChangesAsync(); + } + break; case AyaEvent.Modified: + break; case AyaEvent.Deleted: + break; default: