feat: update GetUserWeeklyBalances response structure and mappings
This commit is contained in:
+7
-2
@@ -10,10 +10,15 @@ public record UserWeeklyBalanceDto
|
|||||||
{
|
{
|
||||||
public long Id { get; init; }
|
public long Id { get; init; }
|
||||||
public long UserId { get; init; }
|
public long UserId { get; init; }
|
||||||
|
public string UserFullName { get; init; } = string.Empty;
|
||||||
public long WeekDefinitionId { get; init; }
|
public long WeekDefinitionId { get; init; }
|
||||||
public string WeekDisplayName { get; init; } = string.Empty;
|
public string WeekDisplayName { get; init; } = string.Empty;
|
||||||
public int LeftLegBalances { get; init; }
|
public int LeftLegNewMembers { get; init; }
|
||||||
public int RightLegBalances { get; init; }
|
public int LeftLegCarryover { get; init; }
|
||||||
|
public int LeftLegTotal { get; init; }
|
||||||
|
public int RightLegNewMembers { get; init; }
|
||||||
|
public int RightLegCarryover { get; init; }
|
||||||
|
public int RightLegTotal { get; init; }
|
||||||
public int TotalBalances { get; init; }
|
public int TotalBalances { get; init; }
|
||||||
public long WeeklyPoolContribution { get; init; }
|
public long WeeklyPoolContribution { get; init; }
|
||||||
public DateTime? CalculatedAt { get; init; }
|
public DateTime? CalculatedAt { get; init; }
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
|
||||||
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
|
||||||
|
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
|
||||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||||
|
using WeeklyPoolsMetaDataDto = BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools.MetaDataDto;
|
||||||
|
using UserBalancesMetaDataDto = BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances.MetaDataDto;
|
||||||
|
|
||||||
namespace BackOffice.BFF.Application.Common.Mappings;
|
namespace BackOffice.BFF.Application.Common.Mappings;
|
||||||
|
|
||||||
@@ -22,7 +25,7 @@ public class CommissionProfile : IRegister
|
|||||||
config.NewConfig<GetAllWeeklyPoolsResponse, GetAllWeeklyPoolsResponseDto>()
|
config.NewConfig<GetAllWeeklyPoolsResponse, GetAllWeeklyPoolsResponseDto>()
|
||||||
.MapWith(src => new GetAllWeeklyPoolsResponseDto
|
.MapWith(src => new GetAllWeeklyPoolsResponseDto
|
||||||
{
|
{
|
||||||
MetaData = new MetaDataDto
|
MetaData = new WeeklyPoolsMetaDataDto
|
||||||
{
|
{
|
||||||
TotalCount = (int)src.MetaData.TotalCount,
|
TotalCount = (int)src.MetaData.TotalCount,
|
||||||
PageSize = (int)src.MetaData.PageSize,
|
PageSize = (int)src.MetaData.PageSize,
|
||||||
@@ -42,5 +45,37 @@ public class CommissionProfile : IRegister
|
|||||||
Created = m.Created.ToDateTime()
|
Created = m.Created.ToDateTime()
|
||||||
}).ToList()
|
}).ToList()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CMS GetUserWeeklyBalancesResponse -> GetUserWeeklyBalancesResponseDto
|
||||||
|
config.NewConfig<GetUserWeeklyBalancesResponse, GetUserWeeklyBalancesResponseDto>()
|
||||||
|
.MapWith(src => new GetUserWeeklyBalancesResponseDto
|
||||||
|
{
|
||||||
|
MetaData = new UserBalancesMetaDataDto
|
||||||
|
{
|
||||||
|
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 UserWeeklyBalanceDto
|
||||||
|
{
|
||||||
|
Id = m.Id,
|
||||||
|
UserId = m.UserId,
|
||||||
|
UserFullName = m.UserFullName ?? string.Empty,
|
||||||
|
WeekDefinitionId = m.WeekDefinitionId,
|
||||||
|
WeekDisplayName = m.WeekDisplayName ?? string.Empty,
|
||||||
|
LeftLegNewMembers = m.LeftLegNewMembers,
|
||||||
|
LeftLegCarryover = m.LeftLegCarryover,
|
||||||
|
LeftLegTotal = m.LeftLegTotal,
|
||||||
|
RightLegNewMembers = m.RightLegNewMembers,
|
||||||
|
RightLegCarryover = m.RightLegCarryover,
|
||||||
|
RightLegTotal = m.RightLegTotal,
|
||||||
|
TotalBalances = m.TotalBalances,
|
||||||
|
WeeklyPoolContribution = m.WeeklyPoolContribution,
|
||||||
|
CalculatedAt = m.CalculatedAt != null ? m.CalculatedAt.ToDateTime() : null,
|
||||||
|
IsExpired = m.IsExpired,
|
||||||
|
Created = m.Created.ToDateTime()
|
||||||
|
}).ToList()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,10 +121,15 @@ public class CommissionProfile : IRegister
|
|||||||
{
|
{
|
||||||
Id = m.Id,
|
Id = m.Id,
|
||||||
UserId = m.UserId,
|
UserId = m.UserId,
|
||||||
|
UserFullName = m.UserFullName ?? string.Empty,
|
||||||
WeekDefinitionId = m.WeekDefinitionId,
|
WeekDefinitionId = m.WeekDefinitionId,
|
||||||
WeekDisplayName = m.WeekDisplayName ?? string.Empty,
|
WeekDisplayName = m.WeekDisplayName ?? string.Empty,
|
||||||
LeftLegBalances = m.LeftLegBalances,
|
LeftLegNewMembers = m.LeftLegNewMembers,
|
||||||
RightLegBalances = m.RightLegBalances,
|
LeftLegCarryover = m.LeftLegCarryover,
|
||||||
|
LeftLegTotal = m.LeftLegTotal,
|
||||||
|
RightLegNewMembers = m.RightLegNewMembers,
|
||||||
|
RightLegCarryover = m.RightLegCarryover,
|
||||||
|
RightLegTotal = m.RightLegTotal,
|
||||||
TotalBalances = m.TotalBalances,
|
TotalBalances = m.TotalBalances,
|
||||||
WeeklyPoolContribution = m.WeeklyPoolContribution,
|
WeeklyPoolContribution = m.WeeklyPoolContribution,
|
||||||
CalculatedAt = m.CalculatedAt.HasValue
|
CalculatedAt = m.CalculatedAt.HasValue
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
|
<PackageId>Foursat.BackOffice.BFF.Commission.Protobuf</PackageId>
|
||||||
<Version>0.0.14</Version>
|
<Version>0.0.15</Version>
|
||||||
<Authors>FourSat</Authors>
|
<Authors>FourSat</Authors>
|
||||||
<Company>FourSat</Company>
|
<Company>FourSat</Company>
|
||||||
<Product>BackOffice.BFF.Commission.Protobuf</Product>
|
<Product>BackOffice.BFF.Commission.Protobuf</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user