using HermesSocketServer.Models; using ILogger = Serilog.ILogger; namespace HermesSocketServer.Requests { public class DeleteRedemption : IRequest { public string Name => "delete_redemption"; public string[] RequiredKeys => ["id"]; private ILogger _logger; public DeleteRedemption(ILogger logger) { _logger = logger; } public Task Grant(Channel channel, IDictionary data) { string id = data["id"].ToString()!; var result = channel.Redemptions.Remove(id); if (result) { _logger.Information($"Deleted a redemption by id [id: {id}]"); return Task.FromResult(RequestResult.Successful(null)); } _logger.Warning($"Redemption ID does not exist [id: {id}]"); return Task.FromResult(RequestResult.Failed("Redemption ID does not exist.")); } } }