Files
BackOffice.BFF/src/BackOffice.BFF.Application/ConfigurationCQ/Commands/DeactivateConfiguration/DeactivateConfigurationCommandHandler.cs
masoodafar-web fe56b8f139
All checks were successful
Build and Deploy / build (push) Successful in 2m18s
feat: add GetAvailableWeeks query and update protobuf imports
2025-12-12 05:57:32 +03:30

32 lines
951 B
C#

using CMSMicroservice.Protobuf.Protos.Configuration;
namespace BackOffice.BFF.Application.ConfigurationCQ.Commands.DeactivateConfiguration;
public class DeactivateConfigurationCommandHandler : IRequestHandler<DeactivateConfigurationCommand, Unit>
{
private readonly IApplicationContractContext _context;
public DeactivateConfigurationCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<Unit> Handle(DeactivateConfigurationCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new DeactivateConfigurationRequest
{
Key = request.Key
};
if (!string.IsNullOrWhiteSpace(request.Reason))
{
grpcRequest.Reason = request.Reason;
}
await _context.Configurations.DeactivateConfigurationAsync(grpcRequest, cancellationToken: cancellationToken);
return Unit.Value;
}
}