forked from AcaMate/AcaMate_API
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using AcaMate.Common.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using AcaMate.V1.Models;
|
|
using Version = AcaMate.V1.Models.Version;
|
|
|
|
namespace AcaMate.Common.Data;
|
|
//database=AcaMate;
|
|
public class AppDbContext: DbContext
|
|
{
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
//MARK: API
|
|
public DbSet<APIHeader> APIHeader { get; set; }
|
|
|
|
//MARK: Program
|
|
public DbSet<Version> Version { get; set; }
|
|
public DbSet<Academy> Academy { get; set; }
|
|
public DbSet<RefreshToken> RefreshTokens { get; set; }
|
|
|
|
//MARK: USER
|
|
public DbSet<Login> Login { get; set; }
|
|
public DbSet<User_Academy> UserAcademy { get; set; }
|
|
public DbSet<User> User { get; set; }
|
|
public DbSet<Permission> Permission { get; set; }
|
|
// public DbSet<Token> Token { get; set; }
|
|
public DbSet<Location> Location { get; set; }
|
|
public DbSet<Contact> Contact { get; set; }
|
|
|
|
//MARK: PUSH
|
|
public DbSet<DBPayload> DBPayload { get; set; }
|
|
public DbSet<PushCabinet> PushCabinet { get; set; }
|
|
|
|
|
|
|
|
|
|
//MARK: LOG
|
|
public DbSet<LogPush> LogPush { get; set; }
|
|
public DbSet<LogUser> LogUser { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<User_Academy>()
|
|
.HasKey(ua => new { ua.uid, ua.bid });
|
|
|
|
// modelBuilder.Entity<PushCabinet>()
|
|
// .HasKey(c => new { c.uid, c.bid, c.pid });
|
|
|
|
modelBuilder.Entity<DBPayload>()
|
|
.HasKey(p => new { p.bid, p.pid });
|
|
|
|
// modelBuilder.Entity<LogPush>().HasNoKey();
|
|
}
|
|
} |