feat: update commission payout model with user names and timestamps
All checks were successful
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 4m11s
All checks were successful
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 4m11s
This commit is contained in:
@@ -12,6 +12,7 @@ public class GetUserCommissionPayoutsQueryHandler : IRequestHandler<GetUserCommi
|
|||||||
public async Task<GetUserCommissionPayoutsResponseDto> Handle(GetUserCommissionPayoutsQuery request, CancellationToken cancellationToken)
|
public async Task<GetUserCommissionPayoutsResponseDto> Handle(GetUserCommissionPayoutsQuery request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var query = _context.UserCommissionPayouts
|
var query = _context.UserCommissionPayouts
|
||||||
|
.Include(x => x.User)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.AsQueryable();
|
.AsQueryable();
|
||||||
|
|
||||||
@@ -41,6 +42,8 @@ public class GetUserCommissionPayoutsQueryHandler : IRequestHandler<GetUserCommi
|
|||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
UserId = x.UserId,
|
UserId = x.UserId,
|
||||||
|
FirstName = x.User.FirstName,
|
||||||
|
LastName = x.User.LastName,
|
||||||
WeekNumber = x.WeekNumber,
|
WeekNumber = x.WeekNumber,
|
||||||
WeeklyPoolId = x.WeeklyPoolId,
|
WeeklyPoolId = x.WeeklyPoolId,
|
||||||
BalancesEarned = x.BalancesEarned,
|
BalancesEarned = x.BalancesEarned,
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class GetUserCommissionPayoutsResponseModel
|
|||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
public string LastName { get; set; } = string.Empty;
|
||||||
public string WeekNumber { get; set; } = string.Empty;
|
public string WeekNumber { get; set; } = string.Empty;
|
||||||
public long WeeklyPoolId { get; set; }
|
public long WeeklyPoolId { get; set; }
|
||||||
public long BalancesEarned { get; set; }
|
public long BalancesEarned { get; set; }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>0.0.149</Version>
|
<Version>0.0.152</Version>
|
||||||
<DebugType>None</DebugType>
|
<DebugType>None</DebugType>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -213,14 +213,16 @@ message UserCommissionPayoutModel
|
|||||||
int64 user_id = 2;
|
int64 user_id = 2;
|
||||||
string user_name = 3;
|
string user_name = 3;
|
||||||
string week_number = 4;
|
string week_number = 4;
|
||||||
int32 balances_earned = 5;
|
int64 weekly_pool_id = 5;
|
||||||
int64 value_per_balance = 6;
|
int64 balances_earned = 6;
|
||||||
int64 total_amount = 7;
|
int64 value_per_balance = 7;
|
||||||
int32 status = 8; // CommissionPayoutStatus enum
|
int64 total_amount = 8;
|
||||||
google.protobuf.Int32Value withdrawal_method = 9;
|
int32 status = 9; // CommissionPayoutStatus enum
|
||||||
string iban_number = 10;
|
google.protobuf.Timestamp paid_at = 10;
|
||||||
google.protobuf.Timestamp created = 11;
|
google.protobuf.Int32Value withdrawal_method = 11;
|
||||||
google.protobuf.Timestamp last_modified = 12;
|
string iban_number = 12;
|
||||||
|
google.protobuf.Timestamp withdrawn_at = 13;
|
||||||
|
google.protobuf.Timestamp created = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommissionPayoutHistory Query
|
// GetCommissionPayoutHistory Query
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using CMSMicroservice.Application.CommissionCQ.Queries.GetAvailableWeeks;
|
using CMSMicroservice.Application.CommissionCQ.Queries.GetAvailableWeeks;
|
||||||
|
using CMSMicroservice.Application.CommissionCQ.Queries.GetUserCommissionPayouts;
|
||||||
using CMSMicroservice.Protobuf.Protos.Commission;
|
using CMSMicroservice.Protobuf.Protos.Commission;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using Google.Protobuf.WellKnownTypes;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
@@ -35,5 +36,28 @@ public class CommissionProfile : IRegister
|
|||||||
.Map(dest => dest.TotalPoolAmount, src => src.TotalPoolAmount ?? 0)
|
.Map(dest => dest.TotalPoolAmount, src => src.TotalPoolAmount ?? 0)
|
||||||
.Map(dest => dest.EligibleUsersCount, src => src.EligibleUsersCount ?? 0)
|
.Map(dest => dest.EligibleUsersCount, src => src.EligibleUsersCount ?? 0)
|
||||||
.Map(dest => dest.DisplayText, src => src.DisplayText);
|
.Map(dest => dest.DisplayText, src => src.DisplayText);
|
||||||
|
|
||||||
|
// GetUserCommissionPayouts Response Model Mapping
|
||||||
|
config.NewConfig<GetUserCommissionPayoutsResponseModel, UserCommissionPayoutModel>()
|
||||||
|
.Map(dest => dest.Id, src => src.Id)
|
||||||
|
.Map(dest => dest.UserId, src => src.UserId)
|
||||||
|
.Map(dest => dest.UserName, src => $"{src.FirstName} {src.LastName}")
|
||||||
|
.Map(dest => dest.WeekNumber, src => src.WeekNumber)
|
||||||
|
.Map(dest => dest.WeeklyPoolId, src => src.WeeklyPoolId)
|
||||||
|
.Map(dest => dest.BalancesEarned, src => src.BalancesEarned)
|
||||||
|
.Map(dest => dest.ValuePerBalance, src => src.ValuePerBalance)
|
||||||
|
.Map(dest => dest.TotalAmount, src => src.TotalAmount)
|
||||||
|
.Map(dest => dest.Status, src => (int)src.Status)
|
||||||
|
.Map(dest => dest.PaidAt, src => src.PaidAt.HasValue
|
||||||
|
? Timestamp.FromDateTime(src.PaidAt.Value.ToUniversalTime())
|
||||||
|
: null)
|
||||||
|
.Map(dest => dest.WithdrawalMethod, src => src.WithdrawalMethod.HasValue
|
||||||
|
? (int)src.WithdrawalMethod.Value
|
||||||
|
: (int?)null)
|
||||||
|
.Map(dest => dest.IbanNumber, src => src.IbanNumber ?? string.Empty)
|
||||||
|
.Map(dest => dest.WithdrawnAt, src => src.WithdrawnAt.HasValue
|
||||||
|
? Timestamp.FromDateTime(src.WithdrawnAt.Value.ToUniversalTime())
|
||||||
|
: null)
|
||||||
|
.Map(dest => dest.Created, src => Timestamp.FromDateTimeOffset(src.Created));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user