2023-08-12 20:13:47 +01:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
2024-03-02 00:43:56 +00:00
|
|
|
using OliverBooth.Common.Data.ValueConverters;
|
|
|
|
using OliverBooth.Common.Data.Web.Users;
|
2023-08-12 20:13:47 +01:00
|
|
|
|
2024-03-02 00:43:56 +00:00
|
|
|
namespace OliverBooth.Common.Data.Web.Configuration;
|
2023-08-12 20:13:47 +01:00
|
|
|
|
|
|
|
internal sealed class UserConfiguration : IEntityTypeConfiguration<User>
|
|
|
|
{
|
|
|
|
/// <inheritdoc />
|
|
|
|
public void Configure(EntityTypeBuilder<User> builder)
|
|
|
|
{
|
2023-08-13 15:25:25 +01:00
|
|
|
builder.ToTable("User");
|
2023-08-12 20:13:47 +01:00
|
|
|
builder.HasKey(e => e.Id);
|
|
|
|
|
|
|
|
builder.Property(e => e.Id).IsRequired();
|
|
|
|
builder.Property(e => e.DisplayName).HasMaxLength(50).IsRequired();
|
|
|
|
builder.Property(e => e.EmailAddress).HasMaxLength(255).IsRequired();
|
|
|
|
builder.Property(e => e.Password).HasMaxLength(255).IsRequired();
|
|
|
|
builder.Property(e => e.Salt).HasMaxLength(255).IsRequired();
|
|
|
|
builder.Property(e => e.Registered).IsRequired();
|
2024-02-20 20:39:52 +00:00
|
|
|
builder.Property(e => e.Totp);
|
2024-02-25 14:18:41 +00:00
|
|
|
builder.Property(e => e.Permissions).HasConversion<PermissionListConverter>();
|
2023-08-12 20:13:47 +01:00
|
|
|
}
|
|
|
|
}
|