Start using JSONB column instead of app side compressed data (#4574)

This commit is contained in:
Nicolas Dorier
2023-02-21 15:06:34 +09:00
committed by GitHub
parent 5c61de3ae9
commit 2bd8227e20
61 changed files with 669 additions and 300 deletions

View File

@@ -48,19 +48,19 @@ namespace BTCPayServer.Data
{
public static WebhookBlob GetBlob(this WebhookData webhook)
{
return JsonConvert.DeserializeObject<WebhookBlob>(Encoding.UTF8.GetString(webhook.Blob));
return webhook.HasTypedBlob<WebhookBlob>().GetBlob();
}
public static void SetBlob(this WebhookData webhook, WebhookBlob blob)
{
webhook.Blob = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(blob));
webhook.HasTypedBlob<WebhookBlob>().SetBlob(blob);
}
public static WebhookDeliveryBlob GetBlob(this WebhookDeliveryData webhook)
{
return JsonConvert.DeserializeObject<WebhookDeliveryBlob>(ZipUtils.Unzip(webhook.Blob), HostedServices.WebhookSender.DefaultSerializerSettings);
return webhook.HasTypedBlob<WebhookDeliveryBlob>().GetBlob(HostedServices.WebhookSender.DefaultSerializerSettings);
}
public static void SetBlob(this WebhookDeliveryData webhook, WebhookDeliveryBlob blob)
{
webhook.Blob = ZipUtils.Zip(JsonConvert.SerializeObject(blob, Formatting.None, HostedServices.WebhookSender.DefaultSerializerSettings));
webhook.HasTypedBlob<WebhookDeliveryBlob>().SetBlob(blob, HostedServices.WebhookSender.DefaultSerializerSettings);
}
}
}