Initial commit: Domain model, Infrastructure, and Database setup
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Hospitality.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hospitality.Infrastructure.Data;
|
||||
|
||||
public class HospitalityDbContext : DbContext
|
||||
{
|
||||
public HospitalityDbContext(DbContextOptions<HospitalityDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<Event> Events { get; set; }
|
||||
public DbSet<Product> Products { get; set; }
|
||||
public DbSet<QuotaDefinition> QuotaDefinitions { get; set; }
|
||||
public DbSet<Group> Groups { get; set; }
|
||||
public DbSet<Person> People { get; set; }
|
||||
public DbSet<PersonQuota> PersonQuotas { get; set; }
|
||||
public DbSet<Transaction> Transactions { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<Person>()
|
||||
.HasIndex(p => p.QrCode)
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user