diff --git a/server/AyaNova/Controllers/NotifySubscriptionController.cs b/server/AyaNova/Controllers/NotifySubscriptionController.cs index 18f1870b..d33650e2 100644 --- a/server/AyaNova/Controllers/NotifySubscriptionController.cs +++ b/server/AyaNova/Controllers/NotifySubscriptionController.cs @@ -9,6 +9,7 @@ using AyaNova.Biz; using System.Linq; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; +using System; namespace AyaNova.Api.Controllers { @@ -168,15 +169,18 @@ namespace AyaNova.Api.Controllers List ret = new List(); foreach (var s in subs) { - ret.Add(new NotifySubscriptionRecord(s.Id, s.UserId, s.EventType, s.AyaType, s.DeliveryMethod, s.DeliveryAddress, s.Tags, await GetInfo(s, ct))); + ret.Add(new NotifySubscriptionRecord(s.Id, s.UserId, s.EventType, s.AyaType, s.DeliveryMethod, s.DeliveryAddress, s.Tags, await GetStatusName(s, ct), s.AgeValue, s.DecValue)); } return Ok(ApiOkResponse.Response(ret)); } - private record NotifySubscriptionRecord(long id, long userid, NotifyEventType eventType, AyaType AyaType, NotifyDeliveryMethod deliveryMethod, string deliveryAddress, List tags, string info); + private record NotifySubscriptionRecord( + long id, long userid, NotifyEventType eventType, AyaType AyaType, + NotifyDeliveryMethod deliveryMethod, string deliveryAddress, List tags, string status, TimeSpan ageValue, decimal decValue + ); //Provide extra info about subscription - private static async Task GetInfo(NotifySubscription s, AyContext ct) + private static async Task GetStatusName(NotifySubscription s, AyContext ct) { switch (s.EventType) { @@ -184,9 +188,11 @@ namespace AyaNova.Api.Controllers case NotifyEventType.WorkorderStatusChange: //add status text to info return await ct.WorkOrderStatus.AsNoTracking().Where(x => x.Id == s.IdValue).Select(x => x.Name).FirstOrDefaultAsync(); - default: - return string.Empty; + case NotifyEventType.QuoteStatusAge: + case NotifyEventType.QuoteStatusChange: + throw new System.NotImplementedException("TODO: quote status events in notifysubscriptioncontroller::getStatusName"); } + return string.Empty; } //------------