From ed45a1759b375101eff1029f3eedbe8ce113802e Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Sat, 27 Dec 2025 21:52:42 +0330 Subject: [PATCH] feat: update user weekly balances model and mappings - Enhanced UserWeeklyBalanceModel with new properties and updated mappings in response DTO and profile --- .../GetAllWeeklyPoolsQueryHandler.cs | 2 +- .../GetUserWeeklyBalancesQueryHandler.cs | 10 ++++++-- .../GetUserWeeklyBalancesResponseDto.cs | 15 +++++++++--- .../CMSMicroservice.Protobuf.csproj | 2 +- .../Protos/commission.proto | 23 +++++++++++-------- .../Common/Mappings/CommissionProfile.cs | 9 ++++++-- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/src/CMSMicroservice.Application/CommissionCQ/Queries/GetAllWeeklyPools/GetAllWeeklyPoolsQueryHandler.cs b/src/CMSMicroservice.Application/CommissionCQ/Queries/GetAllWeeklyPools/GetAllWeeklyPoolsQueryHandler.cs index 88a2040..efdbf9e 100644 --- a/src/CMSMicroservice.Application/CommissionCQ/Queries/GetAllWeeklyPools/GetAllWeeklyPoolsQueryHandler.cs +++ b/src/CMSMicroservice.Application/CommissionCQ/Queries/GetAllWeeklyPools/GetAllWeeklyPoolsQueryHandler.cs @@ -49,7 +49,7 @@ public class GetAllWeeklyPoolsQueryHandler : IRequestHandler x.WeekDefinition) + .Include(x => x.User) .AsNoTracking() .AsQueryable(); @@ -49,10 +50,15 @@ public class GetUserWeeklyBalancesQueryHandler : IRequestHandlernet9.0 enable enable - 0.0.161 + 0.0.162 None False False diff --git a/src/CMSMicroservice.Protobuf/Protos/commission.proto b/src/CMSMicroservice.Protobuf/Protos/commission.proto index 324bad7..fab3faa 100644 --- a/src/CMSMicroservice.Protobuf/Protos/commission.proto +++ b/src/CMSMicroservice.Protobuf/Protos/commission.proto @@ -316,15 +316,20 @@ message UserWeeklyBalanceModel { int64 id = 1; int64 user_id = 2; - int64 week_definition_id = 3; - string week_display_name = 4; - int32 left_leg_balances = 5; - int32 right_leg_balances = 6; - int32 total_balances = 7; - int64 weekly_pool_contribution = 8; - google.protobuf.Timestamp calculated_at = 9; - bool is_expired = 10; - google.protobuf.Timestamp created = 11; + string user_full_name = 3; // نام کامل کاربر + int64 week_definition_id = 4; + string week_display_name = 5; + int32 left_leg_new_members = 6; // اعضای جدید چپ این هفته + int32 left_leg_carryover = 7; // باقیمانده چپ از هفته قبل + int32 left_leg_total = 8; // مجموع چپ (NewMembers + Carryover) + int32 right_leg_new_members = 9; // اعضای جدید راست این هفته + int32 right_leg_carryover = 10; // باقیمانده راست از هفته قبل + int32 right_leg_total = 11; // مجموع راست (NewMembers + Carryover) + int32 total_balances = 12; // تعداد تعادل = MIN(چپ, راست) + int64 weekly_pool_contribution = 13; + google.protobuf.Timestamp calculated_at = 14; + bool is_expired = 15; + google.protobuf.Timestamp created = 16; } // GetAllWeeklyPools Query diff --git a/src/CMSMicroservice.WebApi/Common/Mappings/CommissionProfile.cs b/src/CMSMicroservice.WebApi/Common/Mappings/CommissionProfile.cs index b78422a..ea5ea85 100644 --- a/src/CMSMicroservice.WebApi/Common/Mappings/CommissionProfile.cs +++ b/src/CMSMicroservice.WebApi/Common/Mappings/CommissionProfile.cs @@ -107,10 +107,15 @@ public class CommissionProfile : IRegister config.NewConfig() .Map(dest => dest.Id, src => src.Id) .Map(dest => dest.UserId, src => src.UserId) + .Map(dest => dest.UserFullName, src => src.UserFullName) .Map(dest => dest.WeekDefinitionId, src => src.WeekDefinitionId) .Map(dest => dest.WeekDisplayName, src => src.WeekDisplayName) - .Map(dest => dest.LeftLegBalances, src => src.LeftLegBalances) - .Map(dest => dest.RightLegBalances, src => src.RightLegBalances) + .Map(dest => dest.LeftLegNewMembers, src => src.LeftLegNewMembers) + .Map(dest => dest.LeftLegCarryover, src => src.LeftLegCarryover) + .Map(dest => dest.LeftLegTotal, src => src.LeftLegTotal) + .Map(dest => dest.RightLegNewMembers, src => src.RightLegNewMembers) + .Map(dest => dest.RightLegCarryover, src => src.RightLegCarryover) + .Map(dest => dest.RightLegTotal, src => src.RightLegTotal) .Map(dest => dest.TotalBalances, src => src.TotalBalances) .Map(dest => dest.WeeklyPoolContribution, src => src.WeeklyPoolContribution) .Map(dest => dest.CalculatedAt, src => src.CalculatedAt.HasValue