mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Prune webhook data from database
This commit is contained in:
committed by
Andrew Camilleri
parent
418b476725
commit
4e03c2523a
@@ -153,15 +153,24 @@ namespace BTCPayServer.Controllers.Greenfield
|
||||
var delivery = await StoreRepository.GetWebhookDelivery(CurrentStoreId, webhookId, deliveryId);
|
||||
if (delivery is null)
|
||||
return WebhookDeliveryNotFound();
|
||||
if (delivery.GetBlob().IsPruned())
|
||||
return WebhookDeliveryPruned();
|
||||
return this.Ok(new JValue(await WebhookSender.Redeliver(deliveryId)));
|
||||
}
|
||||
|
||||
private IActionResult WebhookDeliveryPruned()
|
||||
{
|
||||
return this.CreateAPIError(409, "webhookdelivery-pruned", "This webhook delivery has been pruned, so it can't be redelivered");
|
||||
}
|
||||
|
||||
[HttpGet("~/api/v1/stores/{storeId}/webhooks/{webhookId}/deliveries/{deliveryId}/request")]
|
||||
public async Task<IActionResult> GetDeliveryRequest(string storeId, string webhookId, string deliveryId)
|
||||
{
|
||||
var delivery = await StoreRepository.GetWebhookDelivery(CurrentStoreId, webhookId, deliveryId);
|
||||
if (delivery is null)
|
||||
return WebhookDeliveryNotFound();
|
||||
if (delivery.GetBlob().IsPruned())
|
||||
return WebhookDeliveryPruned();
|
||||
return File(delivery.GetBlob().Request, "application/json");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user