2023-02-21 07:06:34 +01:00
|
|
|
using System;
|
2023-05-23 02:18:57 +02:00
|
|
|
using System.Collections.Generic;
|
2023-01-06 14:18:07 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2023-02-21 07:06:34 +01:00
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
2023-05-23 02:18:57 +02:00
|
|
|
using Newtonsoft.Json;
|
2023-04-07 10:48:58 +02:00
|
|
|
using Newtonsoft.Json.Linq;
|
2022-04-19 09:58:31 +02:00
|
|
|
|
|
|
|
namespace BTCPayServer.Data;
|
|
|
|
|
2023-02-21 07:06:34 +01:00
|
|
|
public class LightningAddressData : IHasBlob<LightningAddressDataBlob>
|
2022-04-19 09:58:31 +02:00
|
|
|
{
|
|
|
|
public string Username { get; set; }
|
|
|
|
public string StoreDataId { get; set; }
|
2023-02-21 07:06:34 +01:00
|
|
|
[Obsolete("Use Blob2 instead")]
|
2022-04-19 09:58:31 +02:00
|
|
|
public byte[] Blob { get; set; }
|
2023-02-21 07:06:34 +01:00
|
|
|
public string Blob2 { get; set; }
|
2022-04-19 09:58:31 +02:00
|
|
|
|
|
|
|
public StoreData Store { get; set; }
|
|
|
|
|
|
|
|
|
2023-02-21 07:06:34 +01:00
|
|
|
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
2022-04-19 09:58:31 +02:00
|
|
|
{
|
|
|
|
builder.Entity<LightningAddressData>()
|
|
|
|
.HasOne(o => o.Store)
|
|
|
|
.WithMany(a => a.LightningAddresses)
|
|
|
|
.HasForeignKey(data => data.StoreDataId)
|
|
|
|
.IsRequired()
|
|
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.Entity<LightningAddressData>().HasKey(o => o.Username);
|
2024-04-15 12:08:25 +02:00
|
|
|
builder.Entity<LightningAddressData>()
|
|
|
|
.Property(o => o.Blob2)
|
|
|
|
.HasColumnType("JSONB");
|
2022-04-19 09:58:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class LightningAddressDataBlob
|
|
|
|
{
|
|
|
|
public string CurrencyCode { get; set; }
|
|
|
|
public decimal? Min { get; set; }
|
|
|
|
public decimal? Max { get; set; }
|
2023-04-10 04:07:03 +02:00
|
|
|
|
2023-04-07 10:48:58 +02:00
|
|
|
public JObject InvoiceMetadata { get; set; }
|
2023-05-23 02:18:57 +02:00
|
|
|
|
|
|
|
[JsonExtensionData] public Dictionary<string, JToken> AdditionalData { get; set; }
|
|
|
|
|
2022-04-19 09:58:31 +02:00
|
|
|
}
|