user administration
This commit is contained in:
@@ -9,6 +9,7 @@ public class AppDbContext : DbContext
|
||||
|
||||
public DbSet<Reminder> Reminders => Set<Reminder>();
|
||||
public DbSet<User> Users => Set<User>();
|
||||
public DbSet<Family> Families => Set<Family>();
|
||||
public DbSet<ReminderShare> ReminderShares => Set<ReminderShare>();
|
||||
public DbSet<PasswordResetToken> PasswordResetTokens => Set<PasswordResetToken>();
|
||||
|
||||
@@ -32,6 +33,17 @@ public class AppDbContext : DbContext
|
||||
entity.HasIndex(e => e.Username).IsUnique();
|
||||
entity.Property(e => e.Email).IsRequired().HasMaxLength(200);
|
||||
entity.Property(e => e.Username).IsRequired().HasMaxLength(100);
|
||||
entity.HasOne(e => e.Family)
|
||||
.WithMany(f => f.Users)
|
||||
.HasForeignKey(e => e.FamilyId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Family>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.HasIndex(e => e.Name).IsUnique();
|
||||
entity.Property(e => e.Name).IsRequired().HasMaxLength(100);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ReminderShare>(entity =>
|
||||
|
||||
Reference in New Issue
Block a user