This commit is contained in:
2021-01-01 16:40:25 +00:00
parent 31a5d4c0a7
commit c3f475aadf
5 changed files with 51 additions and 30 deletions

View File

@@ -208,6 +208,10 @@ namespace AyaNova.Biz
// CLEAN OUT OLD EVENTS
//
//
//Any specific event created in objects biz code (not simply "Modified")
//should trigger this remove code prior to updates etc where it creates a new one
//particularly for future delivery ones but will catch the case of a quick double edit of an object that
//would alter what gets delivered in the notification and before it's sent out yet
public static async Task ClearPriorEventsForObject(AyContext ct, AyaType ayaType, long objectId, NotifyEventType eventType)
{
var eventsToDelete = await ct.NotifyEvent.Where(z => z.AyaType == ayaType && z.ObjectId == objectId && z.EventType == eventType).ToListAsync();
@@ -215,6 +219,9 @@ namespace AyaNova.Biz
ct.NotifyEvent.RemoveRange(eventsToDelete);
await ct.SaveChangesAsync();
}
//scorched earth one for outright delete of objects when you don't want any prior events left for it
//probably only ever used for the delete event, can't think of another one right now new years morning early 2021 a bit hungover but possibly there is :)
public static async Task ClearPriorEventsForObject(AyContext ct, AyaType ayaType, long objectId)
{
var eventsToDelete = await ct.NotifyEvent.Where(z => z.AyaType == ayaType && z.ObjectId == objectId).ToListAsync();