diff --git a/server/Controllers/NotifySubscriptionController.cs b/server/Controllers/NotifySubscriptionController.cs index 3c91867..0fc72e1 100644 --- a/server/Controllers/NotifySubscriptionController.cs +++ b/server/Controllers/NotifySubscriptionController.cs @@ -164,12 +164,12 @@ namespace Sockeye.Api.Controllers //and checking of rights long UserId = UserIdFromContext.Id(HttpContext.Items); - var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.UserId == UserId).OrderBy(z=>z.Id).ToListAsync(); + var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.UserId == UserId).OrderBy(z => z.Id).ToListAsync(); List ret = new List(); foreach (var s in subs) { - ret.Add(new NotifySubscriptionRecord(s.Id, s.UserId, s.EventType, s.SockType, s.DeliveryMethod, s.DeliveryAddress, s.Tags, "na-status", s.AgeValue, s.DecValue)); + ret.Add(new NotifySubscriptionRecord(s.Id, s.UserId, s.EventType, s.SockType, s.DeliveryMethod, s.DeliveryAddress, s.Tags, GetStatusName(s, ct), s.AgeValue, s.DecValue)); } return Ok(ApiOkResponse.Response(ret)); @@ -179,7 +179,19 @@ namespace Sockeye.Api.Controllers NotifyDeliveryMethod deliveryMethod, string deliveryAddress, List tags, string status, TimeSpan ageValue, decimal decValue ); - + //Provide extra info about subscription + private static string GetStatusName(NotifySubscription s, AyContext ct) + { + switch (s.EventType) + { + case NotifyEventType.ServerStateStatusAge: + case NotifyEventType.ServerStateStatusChange: + //add status text to info + return ((ServerState)s.IdValue).ToString(); + + } + return string.Empty; + } //------------ diff --git a/server/generator/SockBotProcessVendorNotifications.cs b/server/generator/SockBotProcessVendorNotifications.cs index 34e5410..d1f633d 100644 --- a/server/generator/SockBotProcessVendorNotifications.cs +++ b/server/generator/SockBotProcessVendorNotifications.cs @@ -24,7 +24,11 @@ namespace Sockeye.Biz { private static ILogger log = Sockeye.Util.ApplicationLogging.CreateLogger("SockBotProcessVendorNotifications"); private static DateTime lastSweep = DateTime.MinValue; - private static TimeSpan PROCESS_EVERY_INTERVAL = new TimeSpan(0, 5, 10);//every 5 minutes roughly meaning 15 minutes down is highest fail state +#if (DEBUG) + private static TimeSpan PROCESS_EVERY_INTERVAL = new TimeSpan(0, 0, 30);//every 30 seconds during development +#else + private static TimeSpan PROCESS_EVERY_INTERVAL = new TimeSpan(0, 5, 10);//every 5 minutes +#endif //////////////////////////////////////////////////////////////////////////////////////////////// // DoSweep // diff --git a/server/models/Review.cs b/server/models/Review.cs index b03c986..1eb910b 100644 --- a/server/models/Review.cs +++ b/server/models/Review.cs @@ -39,7 +39,7 @@ namespace Sockeye.Models [Required] public long ObjectId { get; set; } [Required] - public SockType SType { get; set; }//int + public SockType SockType { get; set; }//int [NotMapped] public string ReviewObjectViz { get; set; } @@ -59,7 +59,7 @@ namespace Sockeye.Models } [NotMapped, JsonIgnore] - public SockType SockType { get => SockType.Review; } + public SockType SType { get => SockType.Review; } }//eoc diff --git a/server/resource/en.json b/server/resource/en.json index 992d5d8..dc93de2 100644 --- a/server/resource/en.json +++ b/server/resource/en.json @@ -632,7 +632,7 @@ "NotifyEventReviewImminent": "Review - imminent", "NotifyEventScheduledOnWorkorder": "Scheduled on work order", "NotifyEventScheduledOnWorkorderImminent": "Work order scheduled service imminent", - "NotifyEventServerOperationsProblem": "Server operations problem", + "NotifyEventServerOperationsProblem": "Sockeye server operations problem", "NotifyEventType": "Notification event", "NotifyEventUnitMeterReadingMultipleExceeded": "Unit meter reading multiple exceeded", "NotifyEventUnitWarrantyExpiry": "Unit warranty expiry", diff --git a/server/util/AySchema.cs b/server/util/AySchema.cs index 7277dc4..d51fa81 100644 --- a/server/util/AySchema.cs +++ b/server/util/AySchema.cs @@ -1342,8 +1342,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); #region ADDITIONAL //english translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'en'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Server status changed' FROM atranslation t where t.baselanguage = 'en'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Server status age' FROM atranslation t where t.baselanguage = 'en'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Subscription server status changed' FROM atranslation t where t.baselanguage = 'en'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Subscription server status age' FROM atranslation t where t.baselanguage = 'en'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerExpiring', 'Subscription server expiring' FROM atranslation t where t.baselanguage = 'en'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerLastUpdateAge', 'Subscription server last update age' FROM atranslation t where t.baselanguage = 'en'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerRequestReceived', 'Subscription server requested' FROM atranslation t where t.baselanguage = 'en'"); @@ -1353,8 +1353,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //spanish translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'es'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Server status changed' FROM atranslation t where t.baselanguage = 'es'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Server status age' FROM atranslation t where t.baselanguage = 'es'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Subscription server status changed' FROM atranslation t where t.baselanguage = 'es'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Subscription server status age' FROM atranslation t where t.baselanguage = 'es'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerExpiring', 'Subscription server expiring' FROM atranslation t where t.baselanguage = 'es'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerLastUpdateAge', 'Subscription server last update age' FROM atranslation t where t.baselanguage = 'es'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerRequestReceived', 'Subscription server requested' FROM atranslation t where t.baselanguage = 'es'"); @@ -1364,8 +1364,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //french translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'fr'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Server status changed' FROM atranslation t where t.baselanguage = 'fr'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Server status age' FROM atranslation t where t.baselanguage = 'fr'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Subscription server status changed' FROM atranslation t where t.baselanguage = 'fr'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Subscription server status age' FROM atranslation t where t.baselanguage = 'fr'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerExpiring', 'Subscription server expiring' FROM atranslation t where t.baselanguage = 'fr'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerLastUpdateAge', 'Subscription server last update age' FROM atranslation t where t.baselanguage = 'fr'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerRequestReceived', 'Subscription server requested' FROM atranslation t where t.baselanguage = 'fr'"); @@ -1375,8 +1375,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //german translations await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'DoNotContact', 'Do not contact' FROM atranslation t where t.baselanguage = 'de'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Server status changed' FROM atranslation t where t.baselanguage = 'de'"); - await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Server status age' FROM atranslation t where t.baselanguage = 'de'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusChange', 'Subscription server status changed' FROM atranslation t where t.baselanguage = 'de'"); + await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventServerStateStatusAge', 'Subscription server status age' FROM atranslation t where t.baselanguage = 'de'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerExpiring', 'Subscription server expiring' FROM atranslation t where t.baselanguage = 'de'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerLastUpdateAge', 'Subscription server last update age' FROM atranslation t where t.baselanguage = 'de'"); await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'NotifyEventSubscriptionServerRequestReceived', 'Subscription server requested' FROM atranslation t where t.baselanguage = 'de'"); diff --git a/todo.txt b/todo.txt index 37563cb..c1be718 100644 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,5 @@ TODO: -Simulate new vendor notification, create and save, various scenarios confirm it processes by job, also test notification for that as well Then on to licenses job then on to all the basics, fetch licenses for v7 and v8, trial request processing trigger route, trial subscription server processing and trigger route