diff --git a/server/Controllers/SubscriptionController.cs b/server/Controllers/SubscriptionController.cs index bc32899..3b9a318 100644 --- a/server/Controllers/SubscriptionController.cs +++ b/server/Controllers/SubscriptionController.cs @@ -104,7 +104,7 @@ namespace Sockeye.Api.Controllers else return BadRequest(new ApiErrorResponse(biz.Errors)); } - return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); ; + return Ok(ApiOkResponse.Response(o)); ; } /// diff --git a/server/biz/SubscriptionBiz.cs b/server/biz/SubscriptionBiz.cs index 2ffffa6..3b434be 100644 --- a/server/biz/SubscriptionBiz.cs +++ b/server/biz/SubscriptionBiz.cs @@ -56,6 +56,7 @@ namespace Sockeye.Biz await SearchIndexAsync(newObject, true); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null); await HandlePotentialNotificationEvent(SockEvent.Created, newObject); + await PopulateVizFields(newObject); return newObject; } } @@ -70,6 +71,7 @@ namespace Sockeye.Biz var ret = await ct.Subscription.AsNoTracking().SingleOrDefaultAsync(z => z.Id == id); if (logTheGetEvent && ret != null) await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, SockEvent.Retrieved), ct); + await PopulateVizFields(ret); return ret; } @@ -110,6 +112,7 @@ namespace Sockeye.Biz await SearchIndexAsync(putObject, false); await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags); await HandlePotentialNotificationEvent(SockEvent.Modified, putObject, dbObject); + await PopulateVizFields(putObject); return putObject; } @@ -277,6 +280,15 @@ namespace Sockeye.Biz vc.Add(await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync(), "customer", o.CustomerId); } o.CustomerViz = vc.Get("customer", o.CustomerId); + + foreach (var item in o.Items)//some subscriptions have a bunch of the same monthly or yearly raven user in them so this will save in that case + { + if (!vc.Has("productname", item.ProductId)) + { + vc.Add(await ct.Product.AsNoTracking().Where(x => x.Id == item.ProductId).Select(x => x.Name).FirstOrDefaultAsync(), "productname", item.ProductId); + } + item.ProductViz = vc.Get("productname", item.ProductId); + } } ////////////////////////////////////////////////////////////////////////////////////////////////