using GamificationService.Models.Database; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace GamificationService.Database; public class ApplicationContext : IdentityDbContext { public ApplicationContext(DbContextOptions options) : base(options) { } public DbSet Rights { get; set; } public DbSet RefreshTokens { get; set; } public DbSet Users { get; set; } public DbSet Roles { get; set; } public DbSet UserRoles { get; set; } public DbSet RoleRights { get; set; } public DbSet UserProfiles { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity() .HasKey(ur => new { ur.UserId, ur.RoleId }); modelBuilder.Entity() .HasKey(rr => new { rr.RoleId, rr.RightId }); } }