This commit is contained in:
Jöran Malek 2024-04-05 12:31:34 +02:00
parent 4c2b5cca93
commit 43b4d50e43
28 changed files with 674 additions and 249 deletions

View file

@ -1,5 +1,3 @@
using InkForge.Api.Data.Infrastructure;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
@ -12,25 +10,15 @@ public class ApiDbcontext(
{
public DbSet<WorkspaceEntity> Workspaces { get; set; } = default!;
public DbSet<WorkspaceVersionEntity> WorkspaceVersions { get; set; } = default!;
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<WorkspaceEntity>(options =>
{
options.OwnsOne(m => m.Value);
options.HasKey(m => m.Id);
});
builder.Entity<WorkspaceVersionEntity>(options =>
{
options.OwnsOne(m => m.Value);
options.HasKey(m => m.Version);
options.HasIndex(nameof(WorkspaceVersionEntity.Id), nameof(WorkspaceVersionEntity.Version)).IsUnique();
});
}
}