From f8f8564ca9b07541994854c13ec26db2ce4b4743 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 17 Jul 2020 22:32:57 +0000 Subject: [PATCH] --- devdocs/todo.txt | 14 ++++++++++++++ server/AyaNova/biz/ContractBiz.cs | 9 ++++++--- server/AyaNova/biz/CustomerBiz.cs | 7 +++++-- server/AyaNova/biz/HeadOfficeBiz.cs | 5 ++++- server/AyaNova/biz/LoanUnitBiz.cs | 5 ++++- server/AyaNova/biz/NotifyEventProcessor.cs | 2 +- server/AyaNova/biz/PMBiz.cs | 1 + server/AyaNova/biz/PMTemplateBiz.cs | 5 ++++- server/AyaNova/biz/PartBiz.cs | 5 ++++- server/AyaNova/biz/ProjectBiz.cs | 5 ++++- server/AyaNova/biz/PurchaseOrderBiz.cs | 7 ++++--- server/AyaNova/biz/UnitBiz.cs | 7 ++++--- server/AyaNova/biz/UnitModelBiz.cs | 7 ++++--- server/AyaNova/biz/UserBiz.cs | 4 ++++ server/AyaNova/biz/VendorBiz.cs | 7 ++++--- server/AyaNova/biz/WidgetBiz.cs | 4 ++++ server/AyaNova/biz/WorkOrderBiz.cs | 11 +++++++++++ 17 files changed, 82 insertions(+), 23 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index e681049b..01b0654f 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -3,6 +3,20 @@ {"login": "OpsAdminLimited","password": "OpsAdminLimited"} + + + + Created + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); + + Modified PUT update + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); + + Deleted + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); + + + todo: ip address logged in container mode is the local server as I guess it comes from NGINX is there a way to capture this or...? diff --git a/server/AyaNova/biz/ContractBiz.cs b/server/AyaNova/biz/ContractBiz.cs index dfeba315..c9dd1135 100644 --- a/server/AyaNova/biz/ContractBiz.cs +++ b/server/AyaNova/biz/ContractBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -151,13 +154,13 @@ namespace AyaNova.Biz ct.Contract.Remove(dbObject); await ct.SaveChangesAsync(); - + await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); - await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType,ct); + await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/CustomerBiz.cs b/server/AyaNova/biz/CustomerBiz.cs index 1f92cbda..b82289ca 100644 --- a/server/AyaNova/biz/CustomerBiz.cs +++ b/server/AyaNova/biz/CustomerBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -153,11 +156,11 @@ namespace AyaNova.Biz //Log event await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); - await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType,ct); + await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/HeadOfficeBiz.cs b/server/AyaNova/biz/HeadOfficeBiz.cs index 3dc11293..edb1e0d9 100644 --- a/server/AyaNova/biz/HeadOfficeBiz.cs +++ b/server/AyaNova/biz/HeadOfficeBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -156,8 +159,8 @@ namespace AyaNova.Biz await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/LoanUnitBiz.cs b/server/AyaNova/biz/LoanUnitBiz.cs index 60c0a2ba..42319de5 100644 --- a/server/AyaNova/biz/LoanUnitBiz.cs +++ b/server/AyaNova/biz/LoanUnitBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -156,8 +159,8 @@ namespace AyaNova.Biz await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index b19a7a1e..0925db75 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -110,7 +110,7 @@ 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(AyaEvent ayaEvent, ICoreBizObjectModel newObject, ICoreBizObjectModel dbObject) + internal static async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel newObject, ICoreBizObjectModel originalObject = null) { log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{newObject.AyaType}, AyaEvent:{ayaEvent}]"); //set to true if any changes are made to the context (NotifyEvent added) diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 1a0ef63c..60cefa3c 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -93,6 +93,7 @@ namespace AyaNova.Biz //Handle child and associated items: await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, o.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(o, true); + // await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); // await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, o.Tags, null); return o; diff --git a/server/AyaNova/biz/PMTemplateBiz.cs b/server/AyaNova/biz/PMTemplateBiz.cs index b1786b72..463c5711 100644 --- a/server/AyaNova/biz/PMTemplateBiz.cs +++ b/server/AyaNova/biz/PMTemplateBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -156,8 +159,8 @@ namespace AyaNova.Biz await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/PartBiz.cs b/server/AyaNova/biz/PartBiz.cs index 9dbd4e08..62ade33d 100644 --- a/server/AyaNova/biz/PartBiz.cs +++ b/server/AyaNova/biz/PartBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -156,8 +159,8 @@ namespace AyaNova.Biz await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/ProjectBiz.cs b/server/AyaNova/biz/ProjectBiz.cs index da19e0fe..259fd720 100644 --- a/server/AyaNova/biz/ProjectBiz.cs +++ b/server/AyaNova/biz/ProjectBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -156,8 +159,8 @@ namespace AyaNova.Biz await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/PurchaseOrderBiz.cs b/server/AyaNova/biz/PurchaseOrderBiz.cs index f9af5897..99f73cd8 100644 --- a/server/AyaNova/biz/PurchaseOrderBiz.cs +++ b/server/AyaNova/biz/PurchaseOrderBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -150,14 +153,12 @@ namespace AyaNova.Biz return false; ct.PurchaseOrder.Remove(dbObject); await ct.SaveChangesAsync(); - - //Log event await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/UnitBiz.cs b/server/AyaNova/biz/UnitBiz.cs index 2c1bb242..c911d953 100644 --- a/server/AyaNova/biz/UnitBiz.cs +++ b/server/AyaNova/biz/UnitBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -150,14 +153,12 @@ namespace AyaNova.Biz return false; ct.Unit.Remove(dbObject); await ct.SaveChangesAsync(); - - //Log event await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/UnitModelBiz.cs b/server/AyaNova/biz/UnitModelBiz.cs index aae71e42..5cbf7bba 100644 --- a/server/AyaNova/biz/UnitModelBiz.cs +++ b/server/AyaNova/biz/UnitModelBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -150,14 +153,12 @@ namespace AyaNova.Biz return false; ct.UnitModel.Remove(dbObject); await ct.SaveChangesAsync(); - - //Log event await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 75c41b81..9cb0f52e 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -164,6 +164,7 @@ namespace AyaNova.Biz //TAGS await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, inObj.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, inObj); dtUser retUser = new dtUser(); CopyObject.Copy(inObj, retUser); @@ -206,6 +207,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -295,6 +297,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -365,6 +368,7 @@ namespace AyaNova.Biz await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/VendorBiz.cs b/server/AyaNova/biz/VendorBiz.cs index e57d13db..8efa1623 100644 --- a/server/AyaNova/biz/VendorBiz.cs +++ b/server/AyaNova/biz/VendorBiz.cs @@ -49,6 +49,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -82,6 +83,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -130,6 +132,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -150,14 +153,12 @@ namespace AyaNova.Biz return false; ct.Vendor.Remove(dbObject); await ct.SaveChangesAsync(); - - //Log event await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags); await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); - //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index 5812124e..a0875bd7 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -54,6 +54,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -87,6 +88,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -135,6 +137,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct); await SearchIndexAsync(dbObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj); return dbObject; } @@ -163,6 +166,7 @@ namespace AyaNova.Biz await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct); //all good do the commit await transaction.CommitAsync(); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject); } catch { diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index c93590e9..77b670f7 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -71,6 +71,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await WorkOrderSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -95,6 +96,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct); await WorkOrderSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -415,6 +417,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItem, AyaEvent.Created), ct); await ItemSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -681,6 +684,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemExpense, AyaEvent.Created), ct); await ExpenseSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -871,6 +875,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLabor, AyaEvent.Created), ct); await LaborSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -1060,6 +1065,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemLoan, AyaEvent.Created), ct); await LoanSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -1437,6 +1443,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemPartRequest, AyaEvent.Created), ct); await PartRequestSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -1627,6 +1634,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemScheduledUser, AyaEvent.Created), ct); await ScheduledUserSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -1817,6 +1825,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTask, AyaEvent.Created), ct); await TaskSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -2007,6 +2016,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemTravel, AyaEvent.Created), ct); await TravelSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } } @@ -2197,6 +2207,7 @@ namespace AyaNova.Biz await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderItemUnit, AyaEvent.Created), ct); await UnitSearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); + await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } }