Added missing relations to server db model. Started with server crud. Removed unused relations from detail responses

This commit is contained in:
2024-12-17 22:52:09 +01:00
parent 747712c5c4
commit a34a3ba8b4
20 changed files with 1131 additions and 40 deletions

View File

@@ -161,6 +161,9 @@ namespace MoonlightServers.ApiServer.Database.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<int?>("ServerId")
.HasColumnType("int");
b.Property<long>("Size")
.HasColumnType("bigint");
@@ -169,6 +172,8 @@ namespace MoonlightServers.ApiServer.Database.Migrations
b.HasKey("Id");
b.HasIndex("ServerId");
b.ToTable("ServerBackups", "Servers");
});
@@ -377,10 +382,17 @@ namespace MoonlightServers.ApiServer.Database.Migrations
b.Navigation("Star");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.ServerBackup", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Server", null)
.WithMany("Backups")
.HasForeignKey("ServerId");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.ServerVariable", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Server", "Server")
.WithMany()
.WithMany("Variables")
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -420,6 +432,10 @@ namespace MoonlightServers.ApiServer.Database.Migrations
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Server", b =>
{
b.Navigation("Allocations");
b.Navigation("Backups");
b.Navigation("Variables");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Star", b =>