feat: add GetAvailableWeeks query and update protobuf imports
Build and Deploy / build (push) Successful in 2m18s

This commit is contained in:
masoodafar-web
2025-12-12 05:57:32 +03:30
parent ce3b5db822
commit fe56b8f139
80 changed files with 308 additions and 238 deletions
@@ -1,10 +1,5 @@
using System;
using System.Threading.Tasks;
using BackOffice.BFF.Application.Common.Interfaces;
using Grpc.AspNetCore.Server;
using Grpc.Core;
using Grpc.Core.Interceptors;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace BackOffice.BFF.WebApi.Common.Authorization;
@@ -1,8 +1,6 @@
using BackOffice.BFF.Application.CategoryCQ.Queries.GetAllCategoryByFilter;
using BackOffice.BFF.Application.CategoryCQ.Queries.GetCategory;
using BackOffice.BFF.Application.CategoryCQ.Commands.CreateNewCategory;
using BackOffice.BFF.Category.Protobuf.Protos.Category;
using BackOffice.BFF.Protobuf.Common;
namespace BackOffice.BFF.WebApi.Common.Mappings;
@@ -1,7 +1,3 @@
using BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;
using Foursat.BackOffice.BFF.ClubMembership.Protos;
using Google.Protobuf.WellKnownTypes;
namespace BackOffice.BFF.WebApi.Common.Mappings;
public class ClubMembershipProfile : IRegister
@@ -1,12 +1,8 @@
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWeeklyPool;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserPayouts;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAllWeeklyPools;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetUserWeeklyBalances;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalRequests;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetWithdrawalReports;
using BackOffice.BFF.Application.CommissionCQ.Queries.GetAvailableWeeks;
using Foursat.BackOffice.BFF.Commission.Protos;
using Google.Protobuf.WellKnownTypes;
using BackOffice.BFF.Protobuf.Common;
namespace BackOffice.BFF.WebApi.Common.Mappings;
@@ -20,16 +16,15 @@ public class CommissionProfile : IRegister
{
Id = src.Id,
WeekNumber = src.WeekNumber ?? string.Empty,
// TotalPoolValue = src.TotalPoolValue,
// TotalContributions = src.TotalContributions,
// TotalPayouts = src.TotalPayouts,
// LeftBalance = src.LeftBalance,
// ActiveMembersCount = src.ActiveMembersCount,
TotalBalances = (int)src.TotalBalances,
TotalPoolAmount = src.TotalPoolAmount,
IsCalculated = src.IsCalculated,
CalculatedAt = src.CalculatedAt.HasValue
? Timestamp.FromDateTime(DateTime.SpecifyKind(src.CalculatedAt.Value, DateTimeKind.Utc))
: null,
Created = Timestamp.FromDateTime(DateTime.SpecifyKind(src.CreatedAt, DateTimeKind.Utc))
Created = Timestamp.FromDateTime(DateTime.SpecifyKind(src.Created.DateTime, DateTimeKind.Utc)),
ValuePerBalance = (long)src.ValuePerBalance
});
// GetUserPayoutsResponseDto -> GetUserCommissionPayoutsResponse
@@ -168,5 +163,33 @@ public class CommissionProfile : IRegister
// : null
// }) }
// });
// GetAvailableWeeksResponseDto -> GetAvailableWeeksResponse
config.NewConfig<GetAvailableWeeksResponseDto, GetAvailableWeeksResponse>()
.MapWith(src => new GetAvailableWeeksResponse
{
CurrentWeek = MapWeekInfo(src.CurrentWeek),
CalculatedWeeks = { src.CalculatedWeeks.Select(MapWeekInfo) },
PendingWeeks = { src.PendingWeeks.Select(MapWeekInfo) },
FutureWeeks = { src.FutureWeeks.Select(MapWeekInfo) }
});
}
private static WeekInfo MapWeekInfo(WeekInfoDto dto)
{
return new WeekInfo
{
WeekNumber = dto.WeekNumber,
StartDate = Timestamp.FromDateTime(dto.StartDate.ToUniversalTime()),
EndDate = Timestamp.FromDateTime(dto.EndDate.ToUniversalTime()),
IsCalculated = dto.IsCalculated,
CalculatedAt = dto.CalculatedAt.HasValue
? Timestamp.FromDateTime(dto.CalculatedAt.Value.ToUniversalTime())
: null,
LastExecutionStatus = dto.LastExecutionStatus ?? string.Empty,
TotalPoolAmount = dto.TotalPoolAmount ?? 0,
EligibleUsersCount = dto.EligibleUsersCount ?? 0,
DisplayText = dto.DisplayText
};
}
}
@@ -1,7 +1,5 @@
using BackOffice.BFF.Application.ConfigurationCQ.Queries.GetAllConfigurations;
using Foursat.BackOffice.BFF.Configuration.Protos;
using Google.Protobuf.WellKnownTypes;
using BackOffice.BFF.Protobuf.Common;
namespace BackOffice.BFF.WebApi.Common.Mappings;
@@ -1,11 +1,9 @@
using Mapster;
using BackOffice.BFF.Application.DiscountOrderCQ.Commands.PlaceOrder;
using BackOffice.BFF.Application.DiscountOrderCQ.Commands.CompleteOrderPayment;
using BackOffice.BFF.Application.DiscountOrderCQ.Commands.UpdateOrderStatus;
using BackOffice.BFF.Application.DiscountOrderCQ.Queries.GetOrderById;
using BackOffice.BFF.Application.DiscountOrderCQ.Queries.GetUserOrders;
using BackOffice.BFF.DiscountOrder.Protobuf.Protos.DiscountOrder;
using Google.Protobuf.WellKnownTypes;
namespace BackOffice.BFF.WebApi.Common.Mappings;
@@ -1,9 +1,3 @@
using BackOffice.BFF.Application.ManualPaymentCQ.Queries.GetManualPayments;
using BackOffice.BFF.Application.ManualPaymentCQ.Commands.CreateManualPayment;
using BackOffice.BFF.ManualPayment.Protobuf;
using Google.Protobuf.WellKnownTypes;
using BackOffice.BFF.Protobuf.Common;
namespace BackOffice.BFF.WebApi.Common.Mappings;
public class ManualPaymentProfile : IRegister
@@ -2,8 +2,6 @@ using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
using Foursat.BackOffice.BFF.NetworkMembership.Protos;
using BackOffice.BFF.Protobuf.Common;
using Google.Protobuf.WellKnownTypes;
namespace BackOffice.BFF.WebApi.Common.Mappings;
@@ -1,11 +1,5 @@
using Foursat.BackOffice.BFF.PublicMessage.Protobuf;
namespace BackOffice.BFF.WebApi.Common.Mappings;
using BackOffice.BFF.Application.PublicMessageCQ.Queries.GetAllMessages;
using BackOffice.BFF.Application.PublicMessageCQ.Queries.GetActiveMessages;
using Google.Protobuf.WellKnownTypes;
public class PublicMessageProfile : IRegister
{
void IRegister.Register(TypeAdapterConfig config)
@@ -1,13 +1,5 @@
namespace BackOffice.BFF.WebApi.Common.Mappings;
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using BackOffice.BFF.Application.UserOrderCQ.Commands.UpdateOrderStatus;
using BackOffice.BFF.Application.UserOrderCQ.Commands.ApplyDiscountToOrder;
using BackOffice.BFF.Application.UserOrderCQ.Commands.CancelOrder;
using BackOffice.BFF.Application.UserOrderCQ.Queries.GetOrdersByDateRange;
using BackOffice.BFF.Application.UserOrderCQ.Queries.CalculateOrderPV;
using Google.Protobuf.WellKnownTypes;
public class UserOrderProfile : IRegister
{
void IRegister.Register(TypeAdapterConfig config)
@@ -1,6 +1,5 @@
using System.Security.Claims;
using BackOffice.BFF.Application.Common.Interfaces;
using Microsoft.AspNetCore.Http;
namespace BackOffice.BFF.WebApi.Common.Services;