23 lines
1001 B
C#
23 lines
1001 B
C#
using BackOffice.BFF.Otp.Protobuf.Protos.Otp;
|
|
using BackOffice.BFF.WebApi.Common.Services;
|
|
using BackOffice.BFF.Application.OtpCQ.Commands.SendOtp;
|
|
using BackOffice.BFF.Application.OtpCQ.Commands.VerifyOtpCode;
|
|
namespace BackOffice.BFF.WebApi.Services;
|
|
public class OtpService : OtpContract.OtpContractBase
|
|
{
|
|
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
|
|
|
public OtpService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
|
{
|
|
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
|
}
|
|
public override async Task<Empty> SendOtp(SendOtpRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<SendOtpRequest, SendOtpCommand>(request, context);
|
|
}
|
|
public override async Task<VerifyOtpCodeResponse> VerifyOtpCode(VerifyOtpCodeRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<VerifyOtpCodeRequest, VerifyOtpCodeCommand, VerifyOtpCodeResponse>(request, context);
|
|
}
|
|
}
|