mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
fix: rev db model, added missing entities and helper functions
This commit is contained in:
@@ -5,19 +5,23 @@ using WebApp.Entities;
|
||||
|
||||
namespace WebApp.Data
|
||||
{
|
||||
public class ApplicationDbContext : IdentityDbContext<User, IdentityRole<string>, string>
|
||||
public class ApplicationDbContext : IdentityDbContext//<User, IdentityRole<string>, string>
|
||||
{
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<User> WebUsers => Set<User>();
|
||||
public DbSet<Token> Tokens => Set<Token>();
|
||||
public DbSet<Organisation> Organisations => Set<Organisation>();
|
||||
public DbSet<Event> Events => Set<Event>();
|
||||
public DbSet<Skill> Skills => Set<Skill>();
|
||||
public DbSet<VolunteerSkill> VolunteerSkills => Set<VolunteerSkill>();
|
||||
public DbSet<EventSkill> EventSkills => Set<EventSkill>();
|
||||
public DbSet<EventRegistration> EventRegistrations => Set<EventRegistration>();
|
||||
public DbSet<Message> Messages => Set<Message>();
|
||||
public DbSet<MessageActivity> MessagesActivities => Set<MessageActivity>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@@ -31,7 +35,10 @@ namespace WebApp.Data
|
||||
.HasKey(es => new { es.EventId, es.SkillId });
|
||||
|
||||
builder.Entity<EventRegistration>()
|
||||
.HasKey(er => new { er.UserId, er.EventId });
|
||||
.HasKey(er => new { er.VolunteerId, er.EventId });
|
||||
|
||||
builder.Entity<MessageActivity>()
|
||||
.HasKey(ma => new { ma.Sender, ma.Recipient });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user