feat: Add mappings for Update and Delete Discount Category commands in DiscountCategoryProfile
Build and Deploy / build (push) Failing after 2m33s
Build and Deploy / build (push) Failing after 2m33s
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
using BackOffice.BFF.Application.DiscountCategoryCQ.Commands.CreateDiscountCategory;
|
||||
using BackOffice.BFF.Application.DiscountCategoryCQ.Commands.UpdateDiscountCategory;
|
||||
using BackOffice.BFF.Application.DiscountCategoryCQ.Commands.DeleteDiscountCategory;
|
||||
using BackOffice.BFF.Application.DiscountCategoryCQ.Queries.GetDiscountCategories;
|
||||
using BackOffice.BFF.DiscountCategory.Protobuf.Protos.DiscountCategory;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Mapster;
|
||||
using CreateFileModel = BackOffice.BFF.Application.DiscountCategoryCQ.Commands.CreateDiscountCategory.DiscountCategoryFileModel;
|
||||
using UpdateFileModel = BackOffice.BFF.Application.DiscountCategoryCQ.Commands.UpdateDiscountCategory.DiscountCategoryFileModel;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Common.Mappings;
|
||||
|
||||
@@ -9,6 +14,29 @@ public class DiscountCategoryProfile : IRegister
|
||||
{
|
||||
void IRegister.Register(TypeAdapterConfig config)
|
||||
{
|
||||
// Request to Command mappings
|
||||
config.NewConfig<CreateDiscountCategoryRequest, CreateDiscountCategoryCommand>()
|
||||
.Map(dest => dest.Name, src => src.Name)
|
||||
.Map(dest => dest.Title, src => src.Title)
|
||||
.Map(dest => dest.Description, src => !string.IsNullOrWhiteSpace(src.Description) ? src.Description : null)
|
||||
.Map(dest => dest.ParentCategoryId, src => src.ParentCategoryId > 0 ? src.ParentCategoryId : (long?)null)
|
||||
.Map(dest => dest.SortOrder, src => src.SortOrder)
|
||||
.Map(dest => dest.IsActive, src => src.IsActive)
|
||||
.Map(dest => dest.ImageFile, src => (CreateFileModel)null);
|
||||
|
||||
config.NewConfig<UpdateDiscountCategoryRequest, UpdateDiscountCategoryCommand>()
|
||||
.Map(dest => dest.CategoryId, src => src.CategoryId)
|
||||
.Map(dest => dest.Name, src => src.Name)
|
||||
.Map(dest => dest.Title, src => src.Title)
|
||||
.Map(dest => dest.Description, src => !string.IsNullOrWhiteSpace(src.Description) ? src.Description : null)
|
||||
.Map(dest => dest.ParentCategoryId, src => src.ParentCategoryId > 0 ? src.ParentCategoryId : (long?)null)
|
||||
.Map(dest => dest.SortOrder, src => src.SortOrder)
|
||||
.Map(dest => dest.IsActive, src => src.IsActive)
|
||||
.Map(dest => dest.ImageFile, src => (UpdateFileModel)null);
|
||||
|
||||
config.NewConfig<DeleteDiscountCategoryRequest, DeleteDiscountCategoryCommand>()
|
||||
.Map(dest => dest.CategoryId, src => src.CategoryId);
|
||||
|
||||
// Map GetDiscountCategories response DTO to protobuf response
|
||||
config.NewConfig<GetDiscountCategoriesResponseDto, GetDiscountCategoriesResponse>()
|
||||
.MapWith(src => new GetDiscountCategoriesResponse
|
||||
|
||||
Reference in New Issue
Block a user