feat: basic database model

This commit is contained in:
2025-07-14 12:26:27 +02:00
parent e87c653fae
commit 5e2e70b415
12 changed files with 575 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
// using Microsoft.AspNetCore.Identity;
// using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using QuotifyBE.Entities;
namespace QuotifyBE.Data
{
public class ApplicationDbContext : DbContext //<User, IdentityRole<string>, string>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<User> Users => Set<User>();
public DbSet<Quote> Quotes => Set<Quote>();
public DbSet<Category> Categories => Set<Category>();
public DbSet<Image> Images => Set<Image>();
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<QuoteCategory>()
.HasKey(vs => new { vs.QuoteId, vs.CategoryId });
}
}
}