diff --git a/BTCPayServer.Data/Data/APIKeyData.cs b/BTCPayServer.Data/Data/APIKeyData.cs index ffde380f9..721a1614a 100644 --- a/BTCPayServer.Data/Data/APIKeyData.cs +++ b/BTCPayServer.Data/Data/APIKeyData.cs @@ -6,15 +6,13 @@ namespace BTCPayServer.Data public class APIKeyData { [MaxLength(50)] - public string Id - { - get; - set; - } + public string Id { get; set; } - [MaxLength(50)] public string StoreId { get; set; } + [MaxLength(50)] + public string StoreId { get; set; } - [MaxLength(50)] public string UserId { get; set; } + [MaxLength(50)] + public string UserId { get; set; } public APIKeyType Type { get; set; } = APIKeyType.Legacy; @@ -23,6 +21,7 @@ namespace BTCPayServer.Data public ApplicationUser User { get; set; } public string Label { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/AddressInvoiceData.cs b/BTCPayServer.Data/Data/AddressInvoiceData.cs index f71d338e9..0d62df7b3 100644 --- a/BTCPayServer.Data/Data/AddressInvoiceData.cs +++ b/BTCPayServer.Data/Data/AddressInvoiceData.cs @@ -10,25 +10,11 @@ namespace BTCPayServer.Data /// For not having exceptions thrown by two address on different network, we suffix by "#CRYPTOCODE" /// [Obsolete("Use GetHash instead")] - public string Address - { - get; set; - } + public string Address { get; set; } + public InvoiceData InvoiceData { get; set; } + public string InvoiceDataId { get; set; } + public DateTimeOffset? CreatedTime { get; set; } - public InvoiceData InvoiceData - { - get; set; - } - - public string InvoiceDataId - { - get; set; - } - - public DateTimeOffset? CreatedTime - { - get; set; - } internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/AppData.cs b/BTCPayServer.Data/Data/AppData.cs index 946fa7065..168fe6503 100644 --- a/BTCPayServer.Data/Data/AppData.cs +++ b/BTCPayServer.Data/Data/AppData.cs @@ -8,22 +8,24 @@ namespace BTCPayServer.Data { public string Id { get; set; } public string Name { get; set; } - public string StoreDataId - { - get; set; - } + public string StoreDataId { get; set; } public string AppType { get; set; } - public StoreData StoreData - { - get; set; - } - public DateTimeOffset Created - { - get; set; - } + public StoreData StoreData { get; set; } + public DateTimeOffset Created { get; set; } public bool TagAllInvoices { get; set; } public string Settings { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasOne(o => o.StoreData) + .WithMany(i => i.Apps).OnDelete(DeleteBehavior.Cascade); + builder.Entity() + .HasOne(a => a.StoreData); + } + + // utility methods public T GetSettings() where T : class, new() { if (String.IsNullOrEmpty(Settings)) @@ -35,14 +37,5 @@ namespace BTCPayServer.Data { Settings = value == null ? null : JsonConvert.SerializeObject(value); } - - internal static void OnModelCreating(ModelBuilder builder) - { - builder.Entity() - .HasOne(o => o.StoreData) - .WithMany(i => i.Apps).OnDelete(DeleteBehavior.Cascade); - builder.Entity() - .HasOne(a => a.StoreData); - } } } diff --git a/BTCPayServer.Data/Data/ApplicationDbContext.cs b/BTCPayServer.Data/Data/ApplicationDbContext.cs index 33ce962df..c4b11d62e 100644 --- a/BTCPayServer.Data/Data/ApplicationDbContext.cs +++ b/BTCPayServer.Data/Data/ApplicationDbContext.cs @@ -30,15 +30,8 @@ namespace BTCPayServer.Data _designTime = designTime; } - public DbSet Invoices - { - get; set; - } - public DbSet Refunds - { - get; set; - } - + public DbSet Invoices { get; set; } + public DbSet Refunds { get; set; } public DbSet PlannedTransactions { get; set; } public DbSet PayjoinLocks { get; set; } public DbSet Apps { get; set; } @@ -84,7 +77,6 @@ namespace BTCPayServer.Data InvoiceData.OnModelCreating(builder); InvoiceSearchData.OnModelCreating(builder); PaymentData.OnModelCreating(builder); - Data.UserStore.OnModelCreating(builder); APIKeyData.OnModelCreating(builder); AppData.OnModelCreating(builder); AddressInvoiceData.OnModelCreating(builder); diff --git a/BTCPayServer.Data/Data/ApplicationUser.cs b/BTCPayServer.Data/Data/ApplicationUser.cs index f6825ced1..c5dc97702 100644 --- a/BTCPayServer.Data/Data/ApplicationUser.cs +++ b/BTCPayServer.Data/Data/ApplicationUser.cs @@ -7,27 +7,14 @@ namespace BTCPayServer.Data // Add profile data for application users by adding properties to the ApplicationUser class public class ApplicationUser : IdentityUser { - public List Notifications { get; set; } - public List UserStores - { - get; - set; - } - - public bool RequiresEmailConfirmation - { - get; set; - } - - public List StoredFiles - { - get; - set; - } - + public bool RequiresEmailConfirmation { get; set; } + public List StoredFiles { get; set; } public List U2FDevices { get; set; } public List APIKeys { get; set; } public DateTimeOffset? Created { get; set; } public string DisabledNotifications { get; set; } + + public List Notifications { get; set; } + public List UserStores { get; set; } } } diff --git a/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs b/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs index c77d2beac..2f93ca40b 100644 --- a/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs +++ b/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs @@ -5,39 +5,23 @@ namespace BTCPayServer.Data { public class HistoricalAddressInvoiceData { - public string InvoiceDataId - { - get; set; - } - - public InvoiceData InvoiceData - { - get; set; - } + public string InvoiceDataId { get; set; } + public InvoiceData InvoiceData { get; set; } /// /// Some crypto currencies share same address prefix /// For not having exceptions thrown by two address on different network, we suffix by "#CRYPTOCODE" /// [Obsolete("Use GetCryptoCode instead")] - public string Address - { - get; set; - } + public string Address { get; set; } [Obsolete("Use GetCryptoCode instead")] public string CryptoCode { get; set; } - public DateTimeOffset Assigned - { - get; set; - } + public DateTimeOffset Assigned { get; set; } + public DateTimeOffset? UnAssigned { get; set; } - public DateTimeOffset? UnAssigned - { - get; set; - } internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/InvoiceData.cs b/BTCPayServer.Data/Data/InvoiceData.cs index ecbb64a2d..e2d6ec239 100644 --- a/BTCPayServer.Data/Data/InvoiceData.cs +++ b/BTCPayServer.Data/Data/InvoiceData.cs @@ -7,72 +7,24 @@ namespace BTCPayServer.Data { public class InvoiceData { - public string StoreDataId - { - get; set; - } - public StoreData StoreData - { - get; set; - } + public string Id { get; set; } - public string Id - { - get; set; - } + public string StoreDataId { get; set; } + public StoreData StoreData { get; set; } - public DateTimeOffset Created - { - get; set; - } - public List Payments - { - get; set; - } + public DateTimeOffset Created { get; set; } + public List Payments { get; set; } + public List Events { get; set; } - public List Events - { - get; set; - } + public List HistoricalAddressInvoices { get; set; } - public List HistoricalAddressInvoices - { - get; set; - } - - public byte[] Blob - { - get; set; - } - public string ItemCode - { - get; - set; - } - public string OrderId - { - get; - set; - } - public string Status - { - get; - set; - } - public string ExceptionStatus - { - get; - set; - } - public string CustomerEmail - { - get; - set; - } - public List AddressInvoices - { - get; set; - } + public byte[] Blob { get; set; } + public string ItemCode { get; set; } + public string OrderId { get; set; } + public string Status { get; set; } + public string ExceptionStatus { get; set; } + public string CustomerEmail { get; set; } + public List AddressInvoices { get; set; } public bool Archived { get; set; } public List PendingInvoices { get; set; } public List InvoiceSearchData { get; set; } @@ -80,6 +32,8 @@ namespace BTCPayServer.Data public string CurrentRefundId { get; set; } [ForeignKey("Id,CurrentRefundId")] public RefundData CurrentRefund { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/InvoiceEventData.cs b/BTCPayServer.Data/Data/InvoiceEventData.cs index 7042b7d3f..bda4ef29d 100644 --- a/BTCPayServer.Data/Data/InvoiceEventData.cs +++ b/BTCPayServer.Data/Data/InvoiceEventData.cs @@ -5,23 +5,14 @@ namespace BTCPayServer.Data { public class InvoiceEventData { - public string InvoiceDataId - { - get; set; - } - public InvoiceData InvoiceData - { - get; set; - } + public string InvoiceDataId { get; set; } + public InvoiceData InvoiceData { get; set; } public string UniqueId { get; set; } - public DateTimeOffset Timestamp - { - get; set; - } - + public DateTimeOffset Timestamp { get; set; } public string Message { get; set; } public EventSeverity Severity { get; set; } = EventSeverity.Info; + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() @@ -36,7 +27,7 @@ namespace BTCPayServer.Data #pragma warning restore CS0618 }); } - + public enum EventSeverity { Info, @@ -44,7 +35,7 @@ namespace BTCPayServer.Data Success, Warning } - + public string GetCssClass() { return Severity switch diff --git a/BTCPayServer.Data/Data/InvoiceSearchData.cs b/BTCPayServer.Data/Data/InvoiceSearchData.cs index 464c647ca..935606eda 100644 --- a/BTCPayServer.Data/Data/InvoiceSearchData.cs +++ b/BTCPayServer.Data/Data/InvoiceSearchData.cs @@ -1,7 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/InvoiceWebhookDeliveryData.cs b/BTCPayServer.Data/Data/InvoiceWebhookDeliveryData.cs index 186f02148..e1fa3a915 100644 --- a/BTCPayServer.Data/Data/InvoiceWebhookDeliveryData.cs +++ b/BTCPayServer.Data/Data/InvoiceWebhookDeliveryData.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data @@ -11,6 +8,8 @@ namespace BTCPayServer.Data public InvoiceData Invoice { get; set; } public string DeliveryId { get; set; } public WebhookDeliveryData Delivery { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/NotificationData.cs b/BTCPayServer.Data/Data/NotificationData.cs index aa9d496b4..c18020012 100644 --- a/BTCPayServer.Data/Data/NotificationData.cs +++ b/BTCPayServer.Data/Data/NotificationData.cs @@ -19,6 +19,7 @@ namespace BTCPayServer.Data public bool Seen { get; set; } public byte[] Blob { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/PairedSINData.cs b/BTCPayServer.Data/Data/PairedSINData.cs index 36e7c00c6..d2675b365 100644 --- a/BTCPayServer.Data/Data/PairedSINData.cs +++ b/BTCPayServer.Data/Data/PairedSINData.cs @@ -5,32 +5,16 @@ namespace BTCPayServer.Data { public class PairedSINData { - public string Id - { - get; set; - } + public string Id { get; set; } - public string StoreDataId - { - get; set; - } + public string StoreDataId { get; set; } public StoreData StoreData { get; set; } - public string Label - { - get; - set; - } - public DateTimeOffset PairingTime - { - get; - set; - } - public string SIN - { - get; set; - } + public string Label { get; set; } + public DateTimeOffset PairingTime { get; set; } + public string SIN { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/PairingCodeData.cs b/BTCPayServer.Data/Data/PairingCodeData.cs index 21f6fed6f..9c3ff5997 100644 --- a/BTCPayServer.Data/Data/PairingCodeData.cs +++ b/BTCPayServer.Data/Data/PairingCodeData.cs @@ -5,45 +5,17 @@ namespace BTCPayServer.Data { public class PairingCodeData { - public string Id - { - get; set; - } + public string Id { get; set; } [Obsolete("Unused")] - public string Facade - { - get; set; - } - public string StoreDataId - { - get; set; - } - public DateTimeOffset Expiration - { - get; - set; - } + public string Facade { get; set; } + public string StoreDataId { get; set; } + public DateTimeOffset Expiration { get; set; } + + public string Label { get; set; } + public string SIN { get; set; } + public DateTime DateCreated { get; set; } + public string TokenValue { get; set; } - public string Label - { - get; - set; - } - public string SIN - { - get; - set; - } - public DateTime DateCreated - { - get; - set; - } - public string TokenValue - { - get; - set; - } internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/PaymentData.cs b/BTCPayServer.Data/Data/PaymentData.cs index 32210eb97..1376f8335 100644 --- a/BTCPayServer.Data/Data/PaymentData.cs +++ b/BTCPayServer.Data/Data/PaymentData.cs @@ -4,28 +4,13 @@ namespace BTCPayServer.Data { public class PaymentData { - public string Id - { - get; set; - } + public string Id { get; set; } + public string InvoiceDataId { get; set; } + public InvoiceData InvoiceData { get; set; } - public string InvoiceDataId - { - get; set; - } - public InvoiceData InvoiceData - { - get; set; - } + public byte[] Blob { get; set; } + public bool Accounted { get; set; } - public byte[] Blob - { - get; set; - } - public bool Accounted - { - get; set; - } internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/PaymentRequestData.cs b/BTCPayServer.Data/Data/PaymentRequestData.cs index 0ac26af41..36a5182d2 100644 --- a/BTCPayServer.Data/Data/PaymentRequestData.cs +++ b/BTCPayServer.Data/Data/PaymentRequestData.cs @@ -6,10 +6,7 @@ namespace BTCPayServer.Data public class PaymentRequestData { public string Id { get; set; } - public DateTimeOffset Created - { - get; set; - } + public DateTimeOffset Created { get; set; } public string StoreDataId { get; set; } public bool Archived { get; set; } @@ -19,6 +16,7 @@ namespace BTCPayServer.Data public byte[] Blob { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/PayoutData.cs b/BTCPayServer.Data/Data/PayoutData.cs index 9ef8e22c7..f8f8027ca 100644 --- a/BTCPayServer.Data/Data/PayoutData.cs +++ b/BTCPayServer.Data/Data/PayoutData.cs @@ -21,18 +21,7 @@ namespace BTCPayServer.Data public string Destination { get; set; } public byte[] Blob { get; set; } public byte[] Proof { get; set; } - public bool IsInPeriod(PullPaymentData pp, DateTimeOffset now) - { - var period = pp.GetPeriod(now); - if (period is { } p) - { - return p.Start <= Date && (p.End is DateTimeOffset end ? Date < end : true); - } - else - { - return false; - } - } + internal static void OnModelCreating(ModelBuilder builder) { @@ -49,6 +38,20 @@ namespace BTCPayServer.Data builder.Entity() .HasIndex(o => o.State); } + + // utility methods + public bool IsInPeriod(PullPaymentData pp, DateTimeOffset now) + { + var period = pp.GetPeriod(now); + if (period is { } p) + { + return p.Start <= Date && (p.End is DateTimeOffset end ? Date < end : true); + } + else + { + return false; + } + } } public enum PayoutState diff --git a/BTCPayServer.Data/Data/PendingInvoiceData.cs b/BTCPayServer.Data/Data/PendingInvoiceData.cs index 43e7d2380..a69647bd1 100644 --- a/BTCPayServer.Data/Data/PendingInvoiceData.cs +++ b/BTCPayServer.Data/Data/PendingInvoiceData.cs @@ -4,10 +4,7 @@ namespace BTCPayServer.Data { public class PendingInvoiceData { - public string Id - { - get; set; - } + public string Id { get; set; } public InvoiceData InvoiceData { get; set; } internal static void OnModelCreating(ModelBuilder builder) diff --git a/BTCPayServer.Data/Data/PlannedTransaction.cs b/BTCPayServer.Data/Data/PlannedTransaction.cs index 54d8848c6..cb023841b 100644 --- a/BTCPayServer.Data/Data/PlannedTransaction.cs +++ b/BTCPayServer.Data/Data/PlannedTransaction.cs @@ -7,8 +7,7 @@ namespace BTCPayServer.Data { [Key] [MaxLength(100)] - // Id in the format [cryptocode]-[txid] - public string Id { get; set; } + public string Id { get; set; } // Id in the format [cryptocode]-[txid] public DateTimeOffset BroadcastAt { get; set; } public byte[] Blob { get; set; } } diff --git a/BTCPayServer.Data/Data/PullPaymentData.cs b/BTCPayServer.Data/Data/PullPaymentData.cs index 374b4e6c0..4a1d9bdcb 100644 --- a/BTCPayServer.Data/Data/PullPaymentData.cs +++ b/BTCPayServer.Data/Data/PullPaymentData.cs @@ -8,53 +8,6 @@ using NBitcoin; namespace BTCPayServer.Data { - public static class PayoutExtensions - { - public static IQueryable GetPayoutInPeriod(this IQueryable payouts, PullPaymentData pp) - { - return GetPayoutInPeriod(payouts, pp, DateTimeOffset.UtcNow); - } - public static IQueryable GetPayoutInPeriod(this IQueryable payouts, PullPaymentData pp, DateTimeOffset now) - { - var request = payouts.Where(p => p.PullPaymentDataId == pp.Id); - var period = pp.GetPeriod(now); - if (period is { } p) - { - var start = p.Start; - if (p.End is DateTimeOffset end) - { - return request.Where(p => p.Date >= start && p.Date < end); - } - else - { - return request.Where(p => p.Date >= start); - } - } - else - { - return request.Where(p => false); - } - } - - public static string GetStateString(this PayoutState state) - { - switch (state) - { - case PayoutState.AwaitingApproval: - return "Awaiting Approval"; - case PayoutState.AwaitingPayment: - return "Awaiting Payment"; - case PayoutState.InProgress: - return "In Progress"; - case PayoutState.Completed: - return "Completed"; - case PayoutState.Cancelled: - return "Cancelled"; - default: - throw new ArgumentOutOfRangeException(nameof(state), state, null); - } - } - } public class PullPaymentData { [Key] @@ -71,6 +24,16 @@ namespace BTCPayServer.Data public List Payouts { get; set; } public byte[] Blob { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) + { + builder.Entity() + .HasIndex(o => o.StoreId); + builder.Entity() + .HasOne(o => o.StoreData) + .WithMany(o => o.PullPayments).OnDelete(DeleteBehavior.Cascade); + } + public (DateTimeOffset Start, DateTimeOffset? End)? GetPeriod(DateTimeOffset now) { if (now < StartDate) @@ -121,14 +84,54 @@ namespace BTCPayServer.Data { return !Archived && !IsExpired(now) && HasStarted(now); } + } - internal static void OnModelCreating(ModelBuilder builder) + + public static class PayoutExtensions + { + public static IQueryable GetPayoutInPeriod(this IQueryable payouts, PullPaymentData pp) { - builder.Entity() - .HasIndex(o => o.StoreId); - builder.Entity() - .HasOne(o => o.StoreData) - .WithMany(o => o.PullPayments).OnDelete(DeleteBehavior.Cascade); + return GetPayoutInPeriod(payouts, pp, DateTimeOffset.UtcNow); + } + public static IQueryable GetPayoutInPeriod(this IQueryable payouts, PullPaymentData pp, DateTimeOffset now) + { + var request = payouts.Where(p => p.PullPaymentDataId == pp.Id); + var period = pp.GetPeriod(now); + if (period is { } p) + { + var start = p.Start; + if (p.End is DateTimeOffset end) + { + return request.Where(p => p.Date >= start && p.Date < end); + } + else + { + return request.Where(p => p.Date >= start); + } + } + else + { + return request.Where(p => false); + } + } + + public static string GetStateString(this PayoutState state) + { + switch (state) + { + case PayoutState.AwaitingApproval: + return "Awaiting Approval"; + case PayoutState.AwaitingPayment: + return "Awaiting Payment"; + case PayoutState.InProgress: + return "In Progress"; + case PayoutState.Completed: + return "Completed"; + case PayoutState.Cancelled: + return "Cancelled"; + default: + throw new ArgumentOutOfRangeException(nameof(state), state, null); + } } } } diff --git a/BTCPayServer.Data/Data/RefundData.cs b/BTCPayServer.Data/Data/RefundData.cs index dafbe5bf9..b8caf9cde 100644 --- a/BTCPayServer.Data/Data/RefundData.cs +++ b/BTCPayServer.Data/Data/RefundData.cs @@ -13,6 +13,7 @@ namespace BTCPayServer.Data public PullPaymentData PullPaymentData { get; set; } public InvoiceData InvoiceData { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/SettingData.cs b/BTCPayServer.Data/Data/SettingData.cs index a7421bdc1..a6407721f 100644 --- a/BTCPayServer.Data/Data/SettingData.cs +++ b/BTCPayServer.Data/Data/SettingData.cs @@ -2,14 +2,8 @@ namespace BTCPayServer.Data { public class SettingData { - public string Id - { - get; set; - } + public string Id { get; set; } - public string Value - { - get; set; - } + public string Value { get; set; } } } diff --git a/BTCPayServer.Data/Data/StoreData.cs b/BTCPayServer.Data/Data/StoreData.cs index 11c7269ba..7b893d730 100644 --- a/BTCPayServer.Data/Data/StoreData.cs +++ b/BTCPayServer.Data/Data/StoreData.cs @@ -5,7 +5,6 @@ using BTCPayServer.Client.Models; namespace BTCPayServer.Data { - public class StoreData { public string Id { get; set; } @@ -43,6 +42,4 @@ namespace BTCPayServer.Data public List PairedSINs { get; set; } public IEnumerable APIKeys { get; set; } } - - } diff --git a/BTCPayServer.Data/Data/StoreWebhookData.cs b/BTCPayServer.Data/Data/StoreWebhookData.cs index 02ebbe2af..1d55a059b 100644 --- a/BTCPayServer.Data/Data/StoreWebhookData.cs +++ b/BTCPayServer.Data/Data/StoreWebhookData.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; using Microsoft.EntityFrameworkCore; -using System.Linq; namespace BTCPayServer.Data { @@ -13,6 +9,7 @@ namespace BTCPayServer.Data public WebhookData Webhook { get; set; } public StoreData Store { get; set; } + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/StoredFile.cs b/BTCPayServer.Data/Data/StoredFile.cs index 1281afa15..b3d603043 100644 --- a/BTCPayServer.Data/Data/StoredFile.cs +++ b/BTCPayServer.Data/Data/StoredFile.cs @@ -12,9 +12,6 @@ namespace BTCPayServer.Data public string StorageFileName { get; set; } public DateTime Timestamp { get; set; } public string ApplicationUserId { get; set; } - public ApplicationUser ApplicationUser - { - get; set; - } + public ApplicationUser ApplicationUser { get; set; } } } diff --git a/BTCPayServer.Data/Data/UserStore.cs b/BTCPayServer.Data/Data/UserStore.cs index fc488cef7..f3d365ed0 100644 --- a/BTCPayServer.Data/Data/UserStore.cs +++ b/BTCPayServer.Data/Data/UserStore.cs @@ -4,28 +4,13 @@ namespace BTCPayServer.Data { public class UserStore { - public string ApplicationUserId - { - get; set; - } - public ApplicationUser ApplicationUser - { - get; set; - } + public string ApplicationUserId { get; set; } + public ApplicationUser ApplicationUser { get; set; } + + public string StoreDataId { get; set; } + public StoreData StoreData { get; set; } + public string Role { get; set; } - public string StoreDataId - { - get; set; - } - public StoreData StoreData - { - get; set; - } - public string Role - { - get; - set; - } internal static void OnModelCreating(ModelBuilder builder) { diff --git a/BTCPayServer.Data/Data/WalletTransactionData.cs b/BTCPayServer.Data/Data/WalletTransactionData.cs index 7f7982acb..1b0b2c8eb 100644 --- a/BTCPayServer.Data/Data/WalletTransactionData.cs +++ b/BTCPayServer.Data/Data/WalletTransactionData.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Newtonsoft.Json; namespace BTCPayServer.Data { @@ -11,6 +9,8 @@ namespace BTCPayServer.Data public string TransactionId { get; set; } public string Labels { get; set; } public byte[] Blob { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity() diff --git a/BTCPayServer.Data/Data/WebhookData.cs b/BTCPayServer.Data/Data/WebhookData.cs index ca5b7fd36..d07be4987 100644 --- a/BTCPayServer.Data/Data/WebhookData.cs +++ b/BTCPayServer.Data/Data/WebhookData.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; -using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data { @@ -10,11 +7,7 @@ namespace BTCPayServer.Data { [Key] [MaxLength(25)] - public string Id - { - get; - set; - } + public string Id { get; set; } [Required] public byte[] Blob { get; set; } public List Deliveries { get; set; } diff --git a/BTCPayServer.Data/Data/WebhookDeliveryData.cs b/BTCPayServer.Data/Data/WebhookDeliveryData.cs index 3d74c3763..61423b331 100644 --- a/BTCPayServer.Data/Data/WebhookDeliveryData.cs +++ b/BTCPayServer.Data/Data/WebhookDeliveryData.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data @@ -18,13 +15,12 @@ namespace BTCPayServer.Data public WebhookData Webhook { get; set; } [Required] - public DateTimeOffset Timestamp - { - get; set; - } + public DateTimeOffset Timestamp { get; set; } [Required] public byte[] Blob { get; set; } + + internal static void OnModelCreating(ModelBuilder builder) { builder.Entity()