fix: update commission payout mapping and handle null Created date
Build and Deploy / build (push) Successful in 2m30s
Build and Deploy / build (push) Successful in 2m30s
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ public class GetUserPayoutsQueryHandler : IRequestHandler<GetUserPayoutsQuery, G
|
||||
Status = m.Status,
|
||||
WithdrawalMethod = m.WithdrawalMethod,
|
||||
IbanNumber = m.IbanNumber,
|
||||
Created = m.Created.ToDateTime(),
|
||||
Created = m.Created!=null?m.Created.ToDateTime():DateTime.MinValue,
|
||||
LastModified = m.LastModified?.ToDateTime()
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
+16
-16
@@ -4,21 +4,21 @@ public class GetUserPayoutsQueryValidator : AbstractValidator<GetUserPayoutsQuer
|
||||
{
|
||||
public GetUserPayoutsQueryValidator()
|
||||
{
|
||||
RuleFor(x => x.PaginationState)
|
||||
.NotNull()
|
||||
.WithMessage("موقعیت صفحهبندی الزامی است");
|
||||
|
||||
When(x => x.Filter != null, () =>
|
||||
{
|
||||
RuleFor(x => x.Filter!.UserId)
|
||||
.GreaterThan(0)
|
||||
.When(x => x.Filter!.UserId.HasValue)
|
||||
.WithMessage("شناسه کاربر معتبر نیست");
|
||||
|
||||
RuleFor(x => x.Filter!.WeekNumber)
|
||||
.Matches(@"^\d{4}-W\d{2}$")
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.Filter!.WeekNumber))
|
||||
.WithMessage("فرمت شماره هفته باید به صورت YYYY-Www باشد (مثال: 2025-W48)");
|
||||
});
|
||||
// RuleFor(x => x.PaginationState)
|
||||
// .NotNull()
|
||||
// .WithMessage("موقعیت صفحهبندی الزامی است");
|
||||
//
|
||||
// When(x => x.Filter != null, () =>
|
||||
// {
|
||||
// RuleFor(x => x.Filter!.UserId)
|
||||
// .GreaterThan(0)
|
||||
// .When(x => x.Filter!.UserId.HasValue)
|
||||
// .WithMessage("شناسه کاربر معتبر نیست");
|
||||
//
|
||||
// RuleFor(x => x.Filter!.WeekNumber)
|
||||
// .Matches(@"^\d{4}-W\d{2}$")
|
||||
// .When(x => !string.IsNullOrWhiteSpace(x.Filter!.WeekNumber))
|
||||
// .WithMessage("فرمت شماره هفته باید به صورت YYYY-Www باشد (مثال: 2025-W48)");
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,27 @@ public class CommissionProfile : IRegister
|
||||
{
|
||||
void IRegister.Register(TypeAdapterConfig config)
|
||||
{
|
||||
// GetUserCommissionPayoutsRequest -> GetUserPayoutsQuery
|
||||
config.NewConfig<GetUserCommissionPayoutsRequest, GetUserPayoutsQuery>()
|
||||
.MapWith(src => new GetUserPayoutsQuery
|
||||
{
|
||||
PaginationState = src.PaginationState != null
|
||||
? new BackOffice.BFF.Application.Common.Models.PaginationState
|
||||
{
|
||||
PageNumber = src.PaginationState.PageNumber,
|
||||
PageSize = src.PaginationState.PageSize
|
||||
}
|
||||
: null,
|
||||
Filter = src.Filter != null
|
||||
? new BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts.GetUserPayoutsFilter
|
||||
{
|
||||
UserId = src.Filter.UserId,
|
||||
WeekNumber = src.Filter.WeekNumber,
|
||||
Status = src.Filter.Status
|
||||
}
|
||||
: null
|
||||
});
|
||||
|
||||
// GetWeeklyPoolResponseDto -> GetWeeklyCommissionPoolResponse
|
||||
config.NewConfig<GetWeeklyPoolResponseDto, GetWeeklyCommissionPoolResponse>()
|
||||
.MapWith(src => new GetWeeklyCommissionPoolResponse
|
||||
|
||||
Reference in New Issue
Block a user