feat: update Foursat.CMSMicroservice.Protobuf package version and add mapping for GetAllWeeklyPoolsResponse
Build and Deploy / build (push) Successful in 1m48s

This commit is contained in:
masoodafar-web
2025-12-26 09:44:58 +03:30
parent 4c5cff1a9a
commit c7fc30c83e
2 changed files with 29 additions and 6 deletions
@@ -1,4 +1,5 @@
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
using CMSMicroservice.Protobuf.Protos.Commission;
namespace BackOffice.BFF.Application.Common.Mappings;
@@ -7,7 +8,7 @@ public class CommissionProfile : IRegister
{
void IRegister.Register(TypeAdapterConfig config)
{
config.NewConfig< GetWeeklyCommissionPoolResponse,GetWeeklyPoolResponseDto>()
config.NewConfig<GetWeeklyCommissionPoolResponse, GetWeeklyPoolResponseDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.CalculatedAt, src => src.CalculatedAt)
.Map(dest => dest.IsCalculated, src => src.IsCalculated)
@@ -15,9 +16,31 @@ public class CommissionProfile : IRegister
.Map(dest => dest.TotalPoolAmount, src => src.TotalPoolAmount)
.Map(dest => dest.ValuePerBalance, src => src.ValuePerBalance)
.Map(dest => dest.TotalBalances, src => src.TotalBalances)
.Map(dest => dest.Created, src => src.Created.ToDateTimeOffset())
;
.Map(dest => dest.Created, src => src.Created.ToDateTimeOffset());
// CMS GetAllWeeklyPoolsResponse -> GetAllWeeklyPoolsResponseDto
config.NewConfig<GetAllWeeklyPoolsResponse, GetAllWeeklyPoolsResponseDto>()
.MapWith(src => new GetAllWeeklyPoolsResponseDto
{
MetaData = new MetaDataDto
{
TotalCount = (int)src.MetaData.TotalCount,
PageSize = (int)src.MetaData.PageSize,
CurrentPage = (int)src.MetaData.CurrentPage,
TotalPages = (int)src.MetaData.TotalPage
},
Models = src.Models.Select(m => new WeeklyCommissionPoolDto
{
Id = m.Id,
WeekDefinitionId = m.WeekDefinitionId,
WeekDisplayName = m.WeekDisplayName,
TotalPoolAmount = m.TotalPoolAmount,
TotalBalances = m.TotalBalances,
ValuePerBalance = m.ValuePerBalance,
IsCalculated = m.IsCalculated,
CalculatedAt = m.CalculatedAt != null ? m.CalculatedAt.ToDateTime() : null,
Created = m.Created.ToDateTime()
}).ToList()
});
}
}