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;
}
//------------