This commit is contained in:
2023-01-25 20:07:30 +00:00
parent 423c0dc5a0
commit b9450de83a
6 changed files with 31 additions and 16 deletions

View File

@@ -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<NotifySubscriptionRecord> ret = new List<NotifySubscriptionRecord>();
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<string> 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;
}
//------------

View File

@@ -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
//

View File

@@ -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

View File

@@ -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",

View File

@@ -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'");