diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-10-31 18:16:38 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-10-31 18:16:38 +0100 |
| commit | f0cea15a4f85b47bf13b6db392f4ff97449d53c2 (patch) | |
| tree | 98c0b408394970eb930e53968f153e66043a3044 /code/api/src/Data/Database/MainAppDatabase.cs | |
| parent | 0725e4f7cf4c6f723264b6d461b91c660d144cb7 (diff) | |
| download | greatoffice-f0cea15a4f85b47bf13b6db392f4ff97449d53c2.tar.xz greatoffice-f0cea15a4f85b47bf13b6db392f4ff97449d53c2.zip | |
feat: More models and schema changes
Diffstat (limited to 'code/api/src/Data/Database/MainAppDatabase.cs')
| -rw-r--r-- | code/api/src/Data/Database/MainAppDatabase.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/code/api/src/Data/Database/MainAppDatabase.cs b/code/api/src/Data/Database/MainAppDatabase.cs index b529791..d6409e6 100644 --- a/code/api/src/Data/Database/MainAppDatabase.cs +++ b/code/api/src/Data/Database/MainAppDatabase.cs @@ -20,6 +20,11 @@ public class MainAppDatabase : DbContext, IDataProtectionKeyContext public DbSet<CustomerContact> CustomersContacts { get; set; } public DbSet<CustomerEvent> CustomerEvents { get; set; } public DbSet<CustomerGroup> CustomerGroups { get; set; } + public DbSet<TodoLabel> TodoLabels { get; set; } + public DbSet<TodoCollectionAccessControl> TodoProjectAccessControls { get; set; } + public DbSet<TodoCollection> TodoProjects { get; set; } + public DbSet<TodoComment> TodoComments { get; set; } + public DbSet<Todo> Todos { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<User>(e => { @@ -79,6 +84,32 @@ public class MainAppDatabase : DbContext, IDataProtectionKeyContext e.HasMany(n => n.Customers); e.ToTable("customer_groups"); }); + modelBuilder.Entity<Todo>(e => { + e.HasOne(n => n.Collection); + e.HasOne(n => n.AssignedTo); + e.HasOne(n => n.ClosedBy); + e.HasMany(n => n.Labels); + e.HasMany(n => n.Comments); + e.ToTable("todos"); + }); + modelBuilder.Entity<TodoCollection>(e => { + e.HasOne(n => n.Project); + e.HasMany(n => n.AccessControls); + e.ToTable("todo_collections"); + }); + modelBuilder.Entity<TodoComment>(e => { + e.HasOne(n => n.Todo); + e.ToTable("todo_comments"); + }); + modelBuilder.Entity<TodoLabel>(e => { + e.HasOne(n => n.Todo); + e.ToTable("todo_labels"); + }); + modelBuilder.Entity<TodoCollectionAccessControl>(e => { + e.HasOne(n => n.User); + e.HasOne(n => n.Collection); + e.ToTable("todo_collection_access_controls"); + }); base.OnModelCreating(modelBuilder); } |
