Latest
This commit is contained in:
@@ -67,6 +67,7 @@ public class GetProductDetail : SharedProductDetail
|
||||
.Include(model => model.Options).ThenInclude(option => option.Tiers)
|
||||
.Include(model => model.RuleSets).ThenInclude(rule => rule.Conditions)
|
||||
.Include(model => model.Attributes).ThenInclude(attribute => attribute.AttributeDefinition)
|
||||
.Include(model => model.Categories).ThenInclude(category => category.Category)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (product is null)
|
||||
@@ -78,12 +79,22 @@ public class GetProductDetail : SharedProductDetail
|
||||
var specDtos = MapSpecs(product);
|
||||
var genericAttributes = await LoadGenericAttributesAsync(db, product.Id, cancellationToken);
|
||||
|
||||
var categoryDtos = product.Categories
|
||||
.Where(pc => pc.Category is not null)
|
||||
.Select(pc => new SharedProductDetail.CategoryDto(
|
||||
pc.Category.Id,
|
||||
pc.Category.Name,
|
||||
pc.Category!.Slug ?? string.Empty))
|
||||
.ToList();
|
||||
|
||||
var payload = new SharedProductDetail.ProductDetailDto(
|
||||
product.Id,
|
||||
product.Name,
|
||||
product.Slug ?? normalizedSlug,
|
||||
product.Description,
|
||||
product.Price,
|
||||
product.Sku,
|
||||
categoryDtos,
|
||||
optionDtos,
|
||||
specDtos,
|
||||
genericAttributes);
|
||||
|
||||
Reference in New Issue
Block a user