Add services for club and network membership management
This commit is contained in:
35
src/BackOffice.BFF.WebApi/Services/ClubMembershipService.cs
Normal file
35
src/BackOffice.BFF.WebApi/Services/ClubMembershipService.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using BackOffice.BFF.WebApi.Common.Services;
|
||||
using BackOffice.BFF.Application.ClubMembershipCQ.Commands.ActivateClub;
|
||||
using BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;
|
||||
using CMSMicroservice.Protobuf.Protos.ClubMembership;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Services;
|
||||
|
||||
public class ClubMembershipService : ClubMembershipContract.ClubMembershipContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public ClubMembershipService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
|
||||
public override async Task<Empty> ActivateClubMembership(
|
||||
ActivateClubMembershipRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<ActivateClubMembershipRequest, ActivateClubCommand>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetAllClubMembershipsResponse> GetAllClubMemberships(
|
||||
GetAllClubMembershipsRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetAllClubMembershipsRequest, GetAllClubMembersQuery, GetAllClubMembershipsResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
}
|
||||
84
src/BackOffice.BFF.WebApi/Services/CommissionService.cs
Normal file
84
src/BackOffice.BFF.WebApi/Services/CommissionService.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
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.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;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Services;
|
||||
|
||||
public class CommissionService : CommissionContract.CommissionContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public CommissionService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
|
||||
public override async Task<GetWeeklyCommissionPoolResponse> GetWeeklyCommissionPool(
|
||||
GetWeeklyCommissionPoolRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetWeeklyCommissionPoolRequest, GetWeeklyPoolQuery, GetWeeklyCommissionPoolResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetUserCommissionPayoutsResponse> GetUserCommissionPayouts(
|
||||
GetUserCommissionPayoutsRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetUserCommissionPayoutsRequest, GetUserPayoutsQuery, GetUserCommissionPayoutsResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetAllWeeklyPoolsResponse> GetAllWeeklyPools(
|
||||
GetAllWeeklyPoolsRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetAllWeeklyPoolsRequest, GetAllWeeklyPoolsQuery, GetAllWeeklyPoolsResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetWithdrawalRequestsResponse> GetWithdrawalRequests(
|
||||
GetWithdrawalRequestsRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetWithdrawalRequestsRequest, GetWithdrawalRequestsQuery, GetWithdrawalRequestsResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<ApproveWithdrawalResponse> ApproveWithdrawal(
|
||||
ApproveWithdrawalRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<ApproveWithdrawalRequest, ApproveWithdrawalCommand, ApproveWithdrawalResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<RejectWithdrawalResponse> 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>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using BackOffice.BFF.WebApi.Common.Services;
|
||||
using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetUserNetworkInfo;
|
||||
using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkTree;
|
||||
using BackOffice.BFF.Application.NetworkMembershipCQ.Queries.GetNetworkHistory;
|
||||
using CMSMicroservice.Protobuf.Protos.NetworkMembership;
|
||||
|
||||
namespace BackOffice.BFF.WebApi.Services;
|
||||
|
||||
public class NetworkMembershipService : NetworkMembershipContract.NetworkMembershipContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
|
||||
public NetworkMembershipService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
}
|
||||
|
||||
public override async Task<GetUserNetworkResponse> GetUserNetwork(
|
||||
GetUserNetworkRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetUserNetworkRequest, GetUserNetworkInfoQuery, GetUserNetworkResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetNetworkTreeResponse> GetNetworkTree(
|
||||
GetNetworkTreeRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetNetworkTreeRequest, GetNetworkTreeQuery, GetNetworkTreeResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
|
||||
public override async Task<GetNetworkMembershipHistoryResponse> GetNetworkMembershipHistory(
|
||||
GetNetworkMembershipHistoryRequest request,
|
||||
ServerCallContext context)
|
||||
{
|
||||
return await _dispatchRequestToCQRS.Handle<GetNetworkMembershipHistoryRequest, GetNetworkHistoryQuery, GetNetworkMembershipHistoryResponse>(
|
||||
request,
|
||||
context);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user