using Cloud.Models; using Microsoft.EntityFrameworkCore; using Model; namespace Cloud; public class AppDbContext : DbContext { public AppDbContext(DbContextOptions options) : base(options) { } public DbSet Users { get; set; } public DbSet CardNotes { get; set; } public DbSet UserDecks { get; set; } public DbSet PasskeyCredentials { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(b => { b.HasKey(u => u.Username); }); modelBuilder.Entity(b => { b.HasKey(n => new { n.Username, n.CardName }); }); modelBuilder.Entity(b => { b.HasKey(d => d.Id); if (Database.IsNpgsql()) { b.Property(d => d.Cards).HasColumnType("jsonb"); b.Property(d => d.Divers).HasColumnType("jsonb"); } }); } }