btcpayserver/BTCPayServer.Data/Data/ApplicationUser.cs

51 lines
1.8 KiB
C#
Raw Normal View History

using System;
2017-09-13 08:47:34 +02:00
using System.Collections.Generic;
2020-06-28 10:55:27 +02:00
using Microsoft.AspNetCore.Identity;
2021-11-15 10:27:19 +01:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
2017-09-13 08:47:34 +02:00
namespace BTCPayServer.Data
2017-09-13 08:47:34 +02:00
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser, IHasBlob<UserBlob>
2017-09-13 08:47:34 +02:00
{
public bool RequiresEmailConfirmation { get; set; }
public bool RequiresApproval { get; set; }
public bool Approved { get; set; }
public List<StoredFile> StoredFiles { get; set; }
[Obsolete("U2F support has been replace with FIDO2")]
public List<U2FDevice> U2FDevices { get; set; }
public List<APIKeyData> APIKeys { get; set; }
public DateTimeOffset? Created { get; set; }
public string DisabledNotifications { get; set; }
public List<NotificationData> Notifications { get; set; }
public List<UserStore> UserStores { get; set; }
public List<Fido2Credential> Fido2Credentials { get; set; }
2021-12-31 08:59:02 +01:00
[Obsolete("Use Blob2 instead")]
public byte[] Blob { get; set; }
public string Blob2 { get; set; }
2021-11-15 10:27:19 +01:00
public List<IdentityUserRole<string>> UserRoles { get; set; }
public static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
2021-11-15 10:27:19 +01:00
{
builder.Entity<ApplicationUser>()
.HasMany<IdentityUserRole<string>>(user => user.UserRoles)
.WithOne().HasForeignKey(role => role.UserId);
2024-04-15 12:08:25 +02:00
builder.Entity<ApplicationUser>()
.Property(o => o.Blob2)
.HasColumnType("JSONB");
2021-11-15 10:27:19 +01:00
}
}
public class UserBlob
{
public bool ShowInvoiceStatusChangeHint { get; set; }
public string ImageUrl { get; set; }
public string Name { get; set; }
}
2017-09-13 08:47:34 +02:00
}