This commit is contained in:
2025-10-27 21:39:50 -04:00
parent 31f723bea4
commit 2fecd5b315
22 changed files with 1198 additions and 14 deletions

View File

@@ -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);