This commit is contained in:
masoodafar-web
2025-12-02 03:32:26 +03:30
parent 6cd29e8b26
commit c9dab944fa
56 changed files with 1181 additions and 710 deletions

View File

@@ -2,11 +2,13 @@ using BackOffice.BFF.WebApi.Common.Services;
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.Commands.ApproveWithdrawal;
using BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
using BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
using CMSMicroservice.Protobuf.Protos.Commission;
using Google.Protobuf.WellKnownTypes;
namespace BackOffice.BFF.WebApi.Services;
@@ -46,6 +48,17 @@ public class CommissionService : CommissionContract.CommissionContractBase
context);
}
public override async Task<GetUserWeeklyBalancesResponse> GetUserWeeklyBalances(
GetUserWeeklyBalancesRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetUserWeeklyBalancesRequest, GetUserWeeklyBalancesQuery, GetUserWeeklyBalancesResponse>(
request,
context);
}
// TODO: Uncomment when CMS implements these endpoints
/*
public override async Task<GetWithdrawalRequestsResponse> GetWithdrawalRequests(
GetWithdrawalRequestsRequest request,
ServerCallContext context)
@@ -55,30 +68,24 @@ public class CommissionService : CommissionContract.CommissionContractBase
context);
}
public override async Task<ApproveWithdrawalResponse> ApproveWithdrawal(
public override async Task<Empty> ApproveWithdrawal(
ApproveWithdrawalRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<ApproveWithdrawalRequest, ApproveWithdrawalCommand, ApproveWithdrawalResponse>(
await _dispatchRequestToCQRS.Handle<ApproveWithdrawalRequest, ApproveWithdrawalCommand, ApproveWithdrawalResponseDto>(
request,
context);
return new Empty();
}
public override async Task<RejectWithdrawalResponse> RejectWithdrawal(
public override async Task<Empty> RejectWithdrawal(
RejectWithdrawalRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<RejectWithdrawalRequest, RejectWithdrawalCommand, RejectWithdrawalResponse>(
request,
context);
}
public override async Task<ProcessWithdrawalResponse> ProcessWithdrawal(
ProcessWithdrawalRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<ProcessWithdrawalRequest, ProcessWithdrawalCommand, ProcessWithdrawalResponse>(
await _dispatchRequestToCQRS.Handle<RejectWithdrawalRequest, RejectWithdrawalCommand, RejectWithdrawalResponseDto>(
request,
context);
return new Empty();
}
*/
}

View File

@@ -0,0 +1,52 @@
using CMSMicroservice.Protobuf.Protos.Configuration;
using BackOffice.BFF.WebApi.Common.Services;
using BackOffice.BFF.Application.ConfigurationCQ.Commands.CreateOrUpdateConfiguration;
using BackOffice.BFF.Application.ConfigurationCQ.Commands.DeactivateConfiguration;
using BackOffice.BFF.Application.ConfigurationCQ.Queries.GetAllConfigurations;
using Grpc.Core;
using Google.Protobuf.WellKnownTypes;
using BFFConfigRequest = BackOffice.BFF.Configuration.Protobuf.CreateOrUpdateConfigurationRequest;
using BFFDeactivateRequest = BackOffice.BFF.Configuration.Protobuf.DeactivateConfigurationRequest;
using BFFGetAllRequest = BackOffice.BFF.Configuration.Protobuf.GetAllConfigurationsRequest;
using BFFGetAllResponse = BackOffice.BFF.Configuration.Protobuf.GetAllConfigurationsResponse;
namespace BackOffice.BFF.WebApi.Services;
public class ConfigurationService : ConfigurationContract.ConfigurationContractBase
{
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
public ConfigurationService(IDispatchRequestToCQRS dispatchRequestToCQRS)
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
public override async Task<Empty> CreateOrUpdateConfiguration(
CreateOrUpdateConfigurationRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CreateOrUpdateConfigurationRequest, CreateOrUpdateConfigurationCommand, Empty>(
request,
context);
}
public override async Task<Empty> DeactivateConfiguration(
DeactivateConfigurationRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<DeactivateConfigurationRequest, DeactivateConfigurationCommand, Empty>(
request,
context);
}
public override async Task<GetAllConfigurationsResponse> GetAllConfigurations(
GetAllConfigurationsRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetAllConfigurationsRequest, GetAllConfigurationsQuery, GetAllConfigurationsResponse>(
request,
context);
}
// TODO: Implement GetConfigurationByKey and GetConfigurationHistory if needed
}

View File

@@ -0,0 +1,25 @@
using BackOffice.BFF.Application.HealthCQ.Queries.GetSystemHealth;
using BackOffice.BFF.WebApi.Common.Services;
using BackOffice.BFF.Health.Protobuf;
using Grpc.Core;
namespace BackOffice.BFF.WebApi.Services;
public class HealthService : HealthContract.HealthContractBase
{
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
public HealthService(IDispatchRequestToCQRS dispatchRequestToCQRS)
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
public override async Task<GetSystemHealthResponse> GetSystemHealth(
GetSystemHealthRequest request,
ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetSystemHealthRequest, GetSystemHealthQuery, GetSystemHealthResponse>(
request,
context);
}
}