Added new modules and updated existing logic
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HotlinePlanner.Models;
|
||||
|
||||
namespace HotlinePlanner.Data
|
||||
{
|
||||
public class HotlinePlannerDbContext : DbContext
|
||||
{
|
||||
public HotlinePlannerDbContext(DbContextOptions<HotlinePlannerDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<Token> Tokens { get; set; } = null!;
|
||||
public DbSet<UserProfile> UserProfiles { get; set; } = null!;
|
||||
public DbSet<EventLog> EventLogs { get; set; } = null!;
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<Token>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.Property(e => e.Tenant).IsRequired();
|
||||
entity.Property(e => e.UserId).IsRequired();
|
||||
entity.Property(e => e.EncryptedToken).IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EventLog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.Property(e => e.Level).IsRequired();
|
||||
entity.Property(e => e.Category).IsRequired();
|
||||
entity.Property(e => e.Message).IsRequired();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user