Skip to content

Commit

Permalink
[Products management][Duy] Add 'AttributeId' to products in response
Browse files Browse the repository at this point in the history
  • Loading branch information
duykasama committed Feb 20, 2024
1 parent d3759df commit 3ab4f82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Domus.Domain/Dtos/Products/DtoProductAttributeValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ namespace Domus.Domain.Dtos.Products;

public class DtoProductAttributeValue
{
public Guid AttributeId { get; set; }

public string Name { get; set; } = null!;

public string Value { get; set; } = null!;
Expand Down
2 changes: 1 addition & 1 deletion Domus.Service/AutoMappings/AutoMapperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static void CreateProductMaps(IMapperConfigurationExpression mapper)
.ForMember(dest => dest.DisplayPrice,
opt => opt.MapFrom(src => Math.Round(src.DisplayPrice, 2)))
.ForMember(dest => dest.ProductAttributeValues,
opt => opt.MapFrom((src) => src.ProductAttributeValues.Select(pav => new DtoProductAttributeValue { Name = pav.ProductAttribute.AttributeName, Value = pav.Value, ValueType = pav.ValueType })));
opt => opt.MapFrom((src) => src.ProductAttributeValues.Select(pav => new DtoProductAttributeValue { AttributeId = pav.ProductAttributeId, Name = pav.ProductAttribute.AttributeName, Value = pav.Value, ValueType = pav.ValueType })));

mapper.CreateMap<ProductImage, DtoProductImage>();
mapper.CreateMap<ProductPrice, DtoProductPrice>();
Expand Down

0 comments on commit 3ab4f82

Please sign in to comment.