This commit is contained in:
@@ -9,6 +9,7 @@ using AyaNova.Biz;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace AyaNova.Api.Controllers
|
namespace AyaNova.Api.Controllers
|
||||||
{
|
{
|
||||||
@@ -168,15 +169,18 @@ namespace AyaNova.Api.Controllers
|
|||||||
List<NotifySubscriptionRecord> ret = new List<NotifySubscriptionRecord>();
|
List<NotifySubscriptionRecord> ret = new List<NotifySubscriptionRecord>();
|
||||||
foreach (var s in subs)
|
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));
|
return Ok(ApiOkResponse.Response(ret));
|
||||||
}
|
}
|
||||||
private record NotifySubscriptionRecord(long id, long userid, NotifyEventType eventType, AyaType AyaType, NotifyDeliveryMethod deliveryMethod, string deliveryAddress, List<string> tags, string info);
|
private record NotifySubscriptionRecord(
|
||||||
|
long id, long userid, NotifyEventType eventType, AyaType AyaType,
|
||||||
|
NotifyDeliveryMethod deliveryMethod, string deliveryAddress, List<string> tags, string status, TimeSpan ageValue, decimal decValue
|
||||||
|
);
|
||||||
|
|
||||||
//Provide extra info about subscription
|
//Provide extra info about subscription
|
||||||
private static async Task<string> GetInfo(NotifySubscription s, AyContext ct)
|
private static async Task<string> GetStatusName(NotifySubscription s, AyContext ct)
|
||||||
{
|
{
|
||||||
switch (s.EventType)
|
switch (s.EventType)
|
||||||
{
|
{
|
||||||
@@ -184,9 +188,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
case NotifyEventType.WorkorderStatusChange:
|
case NotifyEventType.WorkorderStatusChange:
|
||||||
//add status text to info
|
//add status text to info
|
||||||
return await ct.WorkOrderStatus.AsNoTracking().Where(x => x.Id == s.IdValue).Select(x => x.Name).FirstOrDefaultAsync();
|
return await ct.WorkOrderStatus.AsNoTracking().Where(x => x.Id == s.IdValue).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
default:
|
case NotifyEventType.QuoteStatusAge:
|
||||||
return string.Empty;
|
case NotifyEventType.QuoteStatusChange:
|
||||||
|
throw new System.NotImplementedException("TODO: quote status events in notifysubscriptioncontroller::getStatusName");
|
||||||
}
|
}
|
||||||
|
return string.Empty;
|
||||||
}
|
}
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user