admin page phaze2
This commit is contained in:
@@ -31,6 +31,7 @@ public sealed class GreenHomeDbContext : DbContext
|
||||
public DbSet<Domain.DevicePostImage> DevicePostImages => Set<Domain.DevicePostImage>();
|
||||
public DbSet<Domain.PowerOutageLog> PowerOutageLogs => Set<Domain.PowerOutageLog>();
|
||||
public DbSet<Domain.UsageCounter> UsageCounters => Set<Domain.UsageCounter>();
|
||||
public DbSet<Domain.AdminAuditLog> AdminAuditLogs => Set<Domain.AdminAuditLog>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -458,5 +459,20 @@ public sealed class GreenHomeDbContext : DbContext
|
||||
b.HasIndex(x => new { x.UserId, x.Date }).IsUnique();
|
||||
b.HasIndex(x => x.Date);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Domain.AdminAuditLog>(b =>
|
||||
{
|
||||
b.ToTable("AdminAuditLogs");
|
||||
b.HasKey(x => x.Id);
|
||||
b.Property(x => x.Action).IsRequired().HasMaxLength(100);
|
||||
b.Property(x => x.TargetId).IsRequired().HasMaxLength(100);
|
||||
b.Property(x => x.Details).HasMaxLength(2000);
|
||||
b.HasOne(x => x.AdminUser)
|
||||
.WithMany()
|
||||
.HasForeignKey(x => x.AdminUserId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
b.HasIndex(x => x.At);
|
||||
b.HasIndex(x => x.AdminUserId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user