diff --git a/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.Designer.cs b/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.Designer.cs
new file mode 100644
index 00000000..0fb9d139
--- /dev/null
+++ b/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.Designer.cs
@@ -0,0 +1,1026 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.Core.Database;
+
+#nullable disable
+
+namespace Moonlight.Core.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20240127110558_AddedServerModels")]
+ partial class AddedServerModels
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("Moonlight.Core.Database.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Avatar")
+ .HasColumnType("TEXT");
+
+ b.Property("Balance")
+ .HasColumnType("REAL");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Flags")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Permissions")
+ .HasColumnType("INTEGER");
+
+ b.Property("TokenValidTimestamp")
+ .HasColumnType("TEXT");
+
+ b.Property("TotpKey")
+ .HasColumnType("TEXT");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.Post", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AuthorId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.ToTable("Posts");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostComment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AuthorId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("PostId")
+ .HasColumnType("INTEGER");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.HasIndex("PostId");
+
+ b.ToTable("PostComments");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostLike", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("PostId")
+ .HasColumnType("INTEGER");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PostId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("PostLikes");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.WordFilter", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Filter")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("WordFilters");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Cpu")
+ .HasColumnType("INTEGER");
+
+ b.Property("Disk")
+ .HasColumnType("INTEGER");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("INTEGER");
+
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("MainAllocationId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Memory")
+ .HasColumnType("INTEGER");
+
+ b.Property("NodeId")
+ .HasColumnType("INTEGER");
+
+ b.Property("OverrideStartupCommand")
+ .HasColumnType("TEXT");
+
+ b.Property("ServiceId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("MainAllocationId");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("ServiceId");
+
+ b.ToTable("Servers");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("IpAddress")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Port")
+ .HasColumnType("INTEGER");
+
+ b.Property("ServerId")
+ .HasColumnType("INTEGER");
+
+ b.Property("ServerNodeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.HasIndex("ServerNodeId");
+
+ b.ToTable("ServerAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerDockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AutoPull")
+ .HasColumnType("INTEGER");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ServerImageId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerImageId");
+
+ b.ToTable("ServerDockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AllocationsNeeded")
+ .HasColumnType("INTEGER");
+
+ b.Property("Author")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("DefaultDockerImageIndex")
+ .HasColumnType("INTEGER");
+
+ b.Property("DonateUrl")
+ .HasColumnType("TEXT");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("InstallShell")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("OnlineDetection")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ParseConfigurations")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("StartupCommand")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateUrl")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AllowUserToEdit")
+ .HasColumnType("INTEGER");
+
+ b.Property("AllowUserToView")
+ .HasColumnType("INTEGER");
+
+ b.Property("DefaultValue")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerImageVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerNode", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Fqdn")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("FtpPort")
+ .HasColumnType("INTEGER");
+
+ b.Property("HttpPort")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UseSsl")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerNodes");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ServerId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("ServerVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.ServiceManagement.Entities.Service", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("ConfigJsonOverride")
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Nickname")
+ .HasColumnType("TEXT");
+
+ b.Property("OwnerId")
+ .HasColumnType("INTEGER");
+
+ b.Property("ProductId")
+ .HasColumnType("INTEGER");
+
+ b.Property("RenewAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Suspended")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OwnerId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("Services");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.ServiceManagement.Entities.ServiceShare", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("ServiceId")
+ .HasColumnType("INTEGER");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServiceId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("ServiceShares");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Coupon", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Amount")
+ .HasColumnType("INTEGER");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Percent")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Coupons");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.CouponUse", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("CouponId")
+ .HasColumnType("INTEGER");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CouponId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("CouponUses");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.GiftCode", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Amount")
+ .HasColumnType("INTEGER");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Value")
+ .HasColumnType("REAL");
+
+ b.HasKey("Id");
+
+ b.ToTable("GiftCodes");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.GiftCodeUse", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("GiftCodeId")
+ .HasColumnType("INTEGER");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GiftCodeId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("GiftCodeUses");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("CategoryId")
+ .HasColumnType("INTEGER");
+
+ b.Property("ConfigJson")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Duration")
+ .HasColumnType("INTEGER");
+
+ b.Property("MaxPerUser")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Price")
+ .HasColumnType("REAL");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Stock")
+ .HasColumnType("INTEGER");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CategoryId");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Transaction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Price")
+ .HasColumnType("REAL");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Transaction");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Theming.Entities.Theme", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Author")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CssUrl")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("DonateUrl")
+ .HasColumnType("TEXT");
+
+ b.Property("Enabled")
+ .HasColumnType("INTEGER");
+
+ b.Property("JsUrl")
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Themes");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Ticketing.Entities.Ticket", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("CreatorId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Open")
+ .HasColumnType("INTEGER");
+
+ b.Property("Priority")
+ .HasColumnType("INTEGER");
+
+ b.Property("ServiceId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Tries")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CreatorId");
+
+ b.HasIndex("ServiceId");
+
+ b.ToTable("Tickets");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Ticketing.Entities.TicketMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Attachment")
+ .HasColumnType("TEXT");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("IsSupport")
+ .HasColumnType("INTEGER");
+
+ b.Property("SenderId")
+ .HasColumnType("INTEGER");
+
+ b.Property("TicketId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SenderId");
+
+ b.HasIndex("TicketId");
+
+ b.ToTable("TicketMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.Post", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", "Author")
+ .WithMany()
+ .HasForeignKey("AuthorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Author");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostComment", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", "Author")
+ .WithMany()
+ .HasForeignKey("AuthorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.Community.Entities.Post", null)
+ .WithMany("Comments")
+ .HasForeignKey("PostId");
+
+ b.Navigation("Author");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostLike", b =>
+ {
+ b.HasOne("Moonlight.Features.Community.Entities.Post", null)
+ .WithMany("Likes")
+ .HasForeignKey("PostId");
+
+ b.HasOne("Moonlight.Core.Database.Entities.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.Server", b =>
+ {
+ b.HasOne("Moonlight.Features.Servers.Entities.ServerImage", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.Servers.Entities.ServerAllocation", "MainAllocation")
+ .WithMany()
+ .HasForeignKey("MainAllocationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.Servers.Entities.ServerNode", "Node")
+ .WithMany()
+ .HasForeignKey("NodeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.ServiceManagement.Entities.Service", "Service")
+ .WithMany()
+ .HasForeignKey("ServiceId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Image");
+
+ b.Navigation("MainAllocation");
+
+ b.Navigation("Node");
+
+ b.Navigation("Service");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerAllocation", b =>
+ {
+ b.HasOne("Moonlight.Features.Servers.Entities.Server", null)
+ .WithMany("Allocations")
+ .HasForeignKey("ServerId");
+
+ b.HasOne("Moonlight.Features.Servers.Entities.ServerNode", null)
+ .WithMany("Allocations")
+ .HasForeignKey("ServerNodeId");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerDockerImage", b =>
+ {
+ b.HasOne("Moonlight.Features.Servers.Entities.ServerImage", null)
+ .WithMany("DockerImages")
+ .HasForeignKey("ServerImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerVariable", b =>
+ {
+ b.HasOne("Moonlight.Features.Servers.Entities.Server", null)
+ .WithMany("Variables")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.ServiceManagement.Entities.Service", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", "Owner")
+ .WithMany()
+ .HasForeignKey("OwnerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.StoreSystem.Entities.Product", "Product")
+ .WithMany()
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Owner");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.ServiceManagement.Entities.ServiceShare", b =>
+ {
+ b.HasOne("Moonlight.Features.ServiceManagement.Entities.Service", null)
+ .WithMany("Shares")
+ .HasForeignKey("ServiceId");
+
+ b.HasOne("Moonlight.Core.Database.Entities.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.CouponUse", b =>
+ {
+ b.HasOne("Moonlight.Features.StoreSystem.Entities.Coupon", "Coupon")
+ .WithMany()
+ .HasForeignKey("CouponId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Core.Database.Entities.User", null)
+ .WithMany("CouponUses")
+ .HasForeignKey("UserId");
+
+ b.Navigation("Coupon");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.GiftCodeUse", b =>
+ {
+ b.HasOne("Moonlight.Features.StoreSystem.Entities.GiftCode", "GiftCode")
+ .WithMany()
+ .HasForeignKey("GiftCodeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Core.Database.Entities.User", null)
+ .WithMany("GiftCodeUses")
+ .HasForeignKey("UserId");
+
+ b.Navigation("GiftCode");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Product", b =>
+ {
+ b.HasOne("Moonlight.Features.StoreSystem.Entities.Category", "Category")
+ .WithMany()
+ .HasForeignKey("CategoryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Category");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.StoreSystem.Entities.Transaction", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", null)
+ .WithMany("Transactions")
+ .HasForeignKey("UserId");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Ticketing.Entities.Ticket", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", "Creator")
+ .WithMany()
+ .HasForeignKey("CreatorId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.Features.ServiceManagement.Entities.Service", "Service")
+ .WithMany()
+ .HasForeignKey("ServiceId");
+
+ b.Navigation("Creator");
+
+ b.Navigation("Service");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Ticketing.Entities.TicketMessage", b =>
+ {
+ b.HasOne("Moonlight.Core.Database.Entities.User", "Sender")
+ .WithMany()
+ .HasForeignKey("SenderId");
+
+ b.HasOne("Moonlight.Features.Ticketing.Entities.Ticket", null)
+ .WithMany("Messages")
+ .HasForeignKey("TicketId");
+
+ b.Navigation("Sender");
+ });
+
+ modelBuilder.Entity("Moonlight.Core.Database.Entities.User", b =>
+ {
+ b.Navigation("CouponUses");
+
+ b.Navigation("GiftCodeUses");
+
+ b.Navigation("Transactions");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.Post", b =>
+ {
+ b.Navigation("Comments");
+
+ b.Navigation("Likes");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.Server", b =>
+ {
+ b.Navigation("Allocations");
+
+ b.Navigation("Variables");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerImage", b =>
+ {
+ b.Navigation("DockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerNode", b =>
+ {
+ b.Navigation("Allocations");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.ServiceManagement.Entities.Service", b =>
+ {
+ b.Navigation("Shares");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Ticketing.Entities.Ticket", b =>
+ {
+ b.Navigation("Messages");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.cs b/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.cs
new file mode 100644
index 00000000..7c53f5d0
--- /dev/null
+++ b/Moonlight/Core/Database/Migrations/20240127110558_AddedServerModels.cs
@@ -0,0 +1,266 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Moonlight.Core.Database.Migrations
+{
+ ///
+ public partial class AddedServerModels : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "ServerImages",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", nullable: false),
+ AllocationsNeeded = table.Column(type: "INTEGER", nullable: false),
+ StartupCommand = table.Column(type: "TEXT", nullable: false),
+ StopCommand = table.Column(type: "TEXT", nullable: false),
+ OnlineDetection = table.Column(type: "TEXT", nullable: false),
+ ParseConfigurations = table.Column(type: "TEXT", nullable: false),
+ InstallDockerImage = table.Column(type: "TEXT", nullable: false),
+ InstallShell = table.Column(type: "TEXT", nullable: false),
+ InstallScript = table.Column(type: "TEXT", nullable: false),
+ Author = table.Column(type: "TEXT", nullable: false),
+ DonateUrl = table.Column(type: "TEXT", nullable: true),
+ UpdateUrl = table.Column(type: "TEXT", nullable: true),
+ DefaultDockerImageIndex = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerImages", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ServerImageVariables",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Key = table.Column(type: "TEXT", nullable: false),
+ DefaultValue = table.Column(type: "TEXT", nullable: false),
+ DisplayName = table.Column(type: "TEXT", nullable: false),
+ Description = table.Column(type: "TEXT", nullable: false),
+ AllowUserToEdit = table.Column(type: "INTEGER", nullable: false),
+ AllowUserToView = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerImageVariables", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ServerNodes",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", nullable: false),
+ Fqdn = table.Column(type: "TEXT", nullable: false),
+ UseSsl = table.Column(type: "INTEGER", nullable: false),
+ Token = table.Column(type: "TEXT", nullable: false),
+ HttpPort = table.Column(type: "INTEGER", nullable: false),
+ FtpPort = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerNodes", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ServerDockerImages",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", nullable: false),
+ DisplayName = table.Column(type: "TEXT", nullable: false),
+ AutoPull = table.Column(type: "INTEGER", nullable: false),
+ ServerImageId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerDockerImages", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ServerDockerImages_ServerImages_ServerImageId",
+ column: x => x.ServerImageId,
+ principalTable: "ServerImages",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ServerAllocations",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ IpAddress = table.Column(type: "TEXT", nullable: false),
+ Port = table.Column(type: "INTEGER", nullable: false),
+ ServerId = table.Column(type: "INTEGER", nullable: true),
+ ServerNodeId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerAllocations", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ServerAllocations_ServerNodes_ServerNodeId",
+ column: x => x.ServerNodeId,
+ principalTable: "ServerNodes",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Servers",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ ServiceId = table.Column(type: "INTEGER", nullable: false),
+ Cpu = table.Column(type: "INTEGER", nullable: false),
+ Memory = table.Column(type: "INTEGER", nullable: false),
+ Disk = table.Column(type: "INTEGER", nullable: false),
+ ImageId = table.Column(type: "INTEGER", nullable: false),
+ DockerImageIndex = table.Column(type: "INTEGER", nullable: false),
+ OverrideStartupCommand = table.Column(type: "TEXT", nullable: true),
+ NodeId = table.Column(type: "INTEGER", nullable: false),
+ MainAllocationId = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Servers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Servers_ServerAllocations_MainAllocationId",
+ column: x => x.MainAllocationId,
+ principalTable: "ServerAllocations",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_ServerImages_ImageId",
+ column: x => x.ImageId,
+ principalTable: "ServerImages",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_ServerNodes_NodeId",
+ column: x => x.NodeId,
+ principalTable: "ServerNodes",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_Services_ServiceId",
+ column: x => x.ServiceId,
+ principalTable: "Services",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ServerVariables",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Key = table.Column(type: "TEXT", nullable: false),
+ Value = table.Column(type: "TEXT", nullable: false),
+ ServerId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerVariables", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ServerVariables_Servers_ServerId",
+ column: x => x.ServerId,
+ principalTable: "Servers",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerAllocations_ServerId",
+ table: "ServerAllocations",
+ column: "ServerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerAllocations_ServerNodeId",
+ table: "ServerAllocations",
+ column: "ServerNodeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerDockerImages_ServerImageId",
+ table: "ServerDockerImages",
+ column: "ServerImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_ImageId",
+ table: "Servers",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_MainAllocationId",
+ table: "Servers",
+ column: "MainAllocationId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_NodeId",
+ table: "Servers",
+ column: "NodeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_ServiceId",
+ table: "Servers",
+ column: "ServiceId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerVariables_ServerId",
+ table: "ServerVariables",
+ column: "ServerId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_ServerAllocations_Servers_ServerId",
+ table: "ServerAllocations",
+ column: "ServerId",
+ principalTable: "Servers",
+ principalColumn: "Id");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_ServerAllocations_ServerNodes_ServerNodeId",
+ table: "ServerAllocations");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Servers_ServerNodes_NodeId",
+ table: "Servers");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_ServerAllocations_Servers_ServerId",
+ table: "ServerAllocations");
+
+ migrationBuilder.DropTable(
+ name: "ServerDockerImages");
+
+ migrationBuilder.DropTable(
+ name: "ServerImageVariables");
+
+ migrationBuilder.DropTable(
+ name: "ServerVariables");
+
+ migrationBuilder.DropTable(
+ name: "ServerNodes");
+
+ migrationBuilder.DropTable(
+ name: "Servers");
+
+ migrationBuilder.DropTable(
+ name: "ServerAllocations");
+
+ migrationBuilder.DropTable(
+ name: "ServerImages");
+ }
+ }
+}
diff --git a/Moonlight/Core/Database/Migrations/DataContextModelSnapshot.cs b/Moonlight/Core/Database/Migrations/DataContextModelSnapshot.cs
index 0e1f2dc9..fbc8ffb5 100644
--- a/Moonlight/Core/Database/Migrations/DataContextModelSnapshot.cs
+++ b/Moonlight/Core/Database/Migrations/DataContextModelSnapshot.cs
@@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Moonlight.Core.Database;
-using Moonlight.Core.Database;
#nullable disable
@@ -18,7 +17,52 @@ namespace Moonlight.Core.Database.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
- modelBuilder.Entity("Moonlight.Core.Database.Entities.Community.Post", b =>
+ modelBuilder.Entity("Moonlight.Core.Database.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Avatar")
+ .HasColumnType("TEXT");
+
+ b.Property("Balance")
+ .HasColumnType("REAL");
+
+ b.Property("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Flags")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Permissions")
+ .HasColumnType("INTEGER");
+
+ b.Property("TokenValidTimestamp")
+ .HasColumnType("TEXT");
+
+ b.Property("TotpKey")
+ .HasColumnType("TEXT");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.Post", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -51,7 +95,7 @@ namespace Moonlight.Core.Database.Migrations
b.ToTable("Posts");
});
- modelBuilder.Entity("Moonlight.Core.Database.Entities.Community.PostComment", b =>
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostComment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -82,7 +126,7 @@ namespace Moonlight.Core.Database.Migrations
b.ToTable("PostComments");
});
- modelBuilder.Entity("Moonlight.Core.Database.Entities.Community.PostLike", b =>
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.PostLike", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -106,7 +150,7 @@ namespace Moonlight.Core.Database.Migrations
b.ToTable("PostLikes");
});
- modelBuilder.Entity("Moonlight.Core.Database.Entities.Community.WordFilter", b =>
+ modelBuilder.Entity("Moonlight.Features.Community.Entities.WordFilter", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -121,7 +165,313 @@ namespace Moonlight.Core.Database.Migrations
b.ToTable("WordFilters");
});
- modelBuilder.Entity("Moonlight.Core.Database.Entities.Store.Category", b =>
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Cpu")
+ .HasColumnType("INTEGER");
+
+ b.Property("Disk")
+ .HasColumnType("INTEGER");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("INTEGER");
+
+ b.Property("ImageId")
+ .HasColumnType("INTEGER");
+
+ b.Property("MainAllocationId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Memory")
+ .HasColumnType("INTEGER");
+
+ b.Property("NodeId")
+ .HasColumnType("INTEGER");
+
+ b.Property("OverrideStartupCommand")
+ .HasColumnType("TEXT");
+
+ b.Property("ServiceId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("MainAllocationId");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("ServiceId");
+
+ b.ToTable("Servers");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("IpAddress")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Port")
+ .HasColumnType("INTEGER");
+
+ b.Property("ServerId")
+ .HasColumnType("INTEGER");
+
+ b.Property("ServerNodeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.HasIndex("ServerNodeId");
+
+ b.ToTable("ServerAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerDockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AutoPull")
+ .HasColumnType("INTEGER");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ServerImageId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerImageId");
+
+ b.ToTable("ServerDockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AllocationsNeeded")
+ .HasColumnType("INTEGER");
+
+ b.Property("Author")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("DefaultDockerImageIndex")
+ .HasColumnType("INTEGER");
+
+ b.Property("DonateUrl")
+ .HasColumnType("TEXT");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("InstallShell")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("OnlineDetection")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("ParseConfigurations")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("StartupCommand")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UpdateUrl")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.Features.Servers.Entities.ServerImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("AllowUserToEdit")
+ .HasColumnType("INTEGER");
+
+ b.Property