This commit is contained in:
@@ -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;
|
||||
}
|
||||
//------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user