2025-11-16 03:28:34 +03:30
|
|
|
using CMSMicroservice.Protobuf.Protos.UserContract;
|
|
|
|
|
|
2025-11-14 15:39:28 +03:30
|
|
|
namespace FrontOffice.BFF.Application.UserCQ.Commands.AcceptContract;
|
|
|
|
|
public class AcceptContractCommandHandler : IRequestHandler<AcceptContractCommand, Unit>
|
|
|
|
|
{
|
|
|
|
|
private readonly IApplicationContractContext _context;
|
2025-11-16 03:28:34 +03:30
|
|
|
private readonly ICurrentUserService _currentUserService;
|
2025-11-14 15:39:28 +03:30
|
|
|
|
2025-11-16 03:28:34 +03:30
|
|
|
public AcceptContractCommandHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
|
2025-11-14 15:39:28 +03:30
|
|
|
{
|
|
|
|
|
_context = context;
|
2025-11-16 03:28:34 +03:30
|
|
|
_currentUserService = currentUserService;
|
2025-11-14 15:39:28 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<Unit> Handle(AcceptContractCommand request, CancellationToken cancellationToken)
|
|
|
|
|
{
|
2025-11-16 03:28:34 +03:30
|
|
|
await _context.UserContract.CreateNewUserContractAsync(new CreateNewUserContractRequest()
|
|
|
|
|
{
|
|
|
|
|
SignGuid = request.SignGuid,
|
|
|
|
|
UserId = long.Parse(_currentUserService.UserId ?? throw new InvalidOperationException()),
|
|
|
|
|
ContractId = 1,
|
|
|
|
|
SignedPdfFile = request.ContractHtml,
|
|
|
|
|
}, cancellationToken: cancellationToken);
|
2025-11-14 15:39:28 +03:30
|
|
|
return new Unit();
|
|
|
|
|
}
|
|
|
|
|
}
|