diff --git a/.gitignore b/.gitignore
index 4ec99a8..7487adb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,4 +38,6 @@ _UpgradeReport_Files/
Thumbs.db
Desktop.ini
.DS_Store
-.idea/.idea.Moonlight/.idea/discord.xml
\ No newline at end of file
+.idea/.idea.Moonlight/.idea/discord.xml
+
+storage/
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Moonlight/App/Database/DataContext.cs b/Moonlight/App/Database/DataContext.cs
index 906ce00..dc3e77d 100644
--- a/Moonlight/App/Database/DataContext.cs
+++ b/Moonlight/App/Database/DataContext.cs
@@ -18,7 +18,6 @@ public class DataContext : DbContext
public DbSet DockerImages { get; set; }
public DbSet Images { get; set; }
- public DbSet ImageTags { get; set; }
public DbSet ImageVariables { get; set; }
public DbSet Nodes { get; set; }
public DbSet NodeAllocations { get; set; }
@@ -39,6 +38,10 @@ public class DataContext : DbContext
public DbSet NotificationActions { get; set; }
public DbSet DdosAttacks { get; set; }
public DbSet Subscriptions { get; set; }
+ public DbSet PleskServers { get; set; }
+ public DbSet Websites { get; set; }
+ public DbSet Statistics { get; set; }
+ public DbSet NewsEntries { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
diff --git a/Moonlight/App/Database/Entities/NewsEntry.cs b/Moonlight/App/Database/Entities/NewsEntry.cs
new file mode 100644
index 0000000..d40fb26
--- /dev/null
+++ b/Moonlight/App/Database/Entities/NewsEntry.cs
@@ -0,0 +1,10 @@
+namespace Moonlight.App.Database.Entities;
+
+public class NewsEntry
+{
+ public int Id { get; set; }
+
+ public DateTime Date { get; set; }
+ public string Title { get; set; }
+ public string Markdown { get; set; }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/ImageTag.cs b/Moonlight/App/Database/Entities/PleskServer.cs
similarity index 51%
rename from Moonlight/App/Database/Entities/ImageTag.cs
rename to Moonlight/App/Database/Entities/PleskServer.cs
index 7f3063f..a4cd630 100644
--- a/Moonlight/App/Database/Entities/ImageTag.cs
+++ b/Moonlight/App/Database/Entities/PleskServer.cs
@@ -1,7 +1,9 @@
namespace Moonlight.App.Database.Entities;
-public class ImageTag
+public class PleskServer
{
public int Id { get; set; }
public string Name { get; set; } = "";
+ public string ApiUrl { get; set; } = "";
+ public string ApiKey { get; set; } = "";
}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/Server.cs b/Moonlight/App/Database/Entities/Server.cs
index cad9ced..aa55d81 100644
--- a/Moonlight/App/Database/Entities/Server.cs
+++ b/Moonlight/App/Database/Entities/Server.cs
@@ -17,7 +17,7 @@ public class Server
public List Variables { get; set; } = new();
public List Backups { get; set; } = new();
public List Allocations { get; set; } = new();
- public NodeAllocation MainAllocation { get; set; } = null!;
+ public NodeAllocation? MainAllocation { get; set; } = null;
public Node Node { get; set; } = null!;
public User Owner { get; set; } = null!;
public bool IsCleanupException { get; set; } = false;
diff --git a/Moonlight/App/Database/Entities/StatisticsData.cs b/Moonlight/App/Database/Entities/StatisticsData.cs
new file mode 100644
index 0000000..64f8ea7
--- /dev/null
+++ b/Moonlight/App/Database/Entities/StatisticsData.cs
@@ -0,0 +1,12 @@
+namespace Moonlight.App.Database.Entities;
+
+public class StatisticsData
+{
+ public int Id { get; set; }
+
+ public string Chart { get; set; }
+
+ public double Value { get; set; }
+
+ public DateTime Date { get; set; }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/Website.cs b/Moonlight/App/Database/Entities/Website.cs
new file mode 100644
index 0000000..56e9fd1
--- /dev/null
+++ b/Moonlight/App/Database/Entities/Website.cs
@@ -0,0 +1,12 @@
+namespace Moonlight.App.Database.Entities;
+
+public class Website
+{
+ public int Id { get; set; }
+ public string BaseDomain { get; set; } = "";
+ public int PleskId { get; set; }
+ public PleskServer PleskServer { get; set; }
+ public User Owner { get; set; }
+ public string FtpLogin { get; set; } = "";
+ public string FtpPassword { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.Designer.cs b/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.Designer.cs
new file mode 100644
index 0000000..c835576
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.Designer.cs
@@ -0,0 +1,946 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.App.Database;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230404181522_AddedPleskAndWebsiteModels")]
+ partial class AddedPleskAndWebsiteModels
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DdosAttack", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Data")
+ .HasColumnType("bigint");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("Ongoing")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NodeId");
+
+ b.ToTable("DdosAttacks");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Default")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("DockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Domain", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("SharedDomainId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OwnerId");
+
+ b.HasIndex("SharedDomainId");
+
+ b.ToTable("Domains");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Allocations")
+ .HasColumnType("int");
+
+ b.Property("ConfigFiles")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallEntrypoint")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Startup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StartupDetection")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TagsJson")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ImageTags");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DefaultValue")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LoadingMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("LoadingMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.AuditLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("AuditLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.ErrorLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Class")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Stacktrace")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.ToTable("ErrorLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.SecurityLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("SecurityLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Fqdn")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("HttpPort")
+ .HasColumnType("int");
+
+ b.Property("MoonlightDaemonPort")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SftpPort")
+ .HasColumnType("int");
+
+ b.Property("Ssl")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TokenId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Nodes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("Port")
+ .HasColumnType("int");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("NodeAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NotificationClientId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NotificationClientId");
+
+ b.ToTable("NotificationActions");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationClient", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("NotificationClients");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.PleskServer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ApiKey")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ApiUrl")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("PleskServers");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Revoke", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Identifier")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Revokes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Cpu")
+ .HasColumnType("int");
+
+ b.Property("Disk")
+ .HasColumnType("bigint");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("int");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Installing")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsCleanupException")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("MainAllocationId")
+ .HasColumnType("int");
+
+ b.Property("Memory")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("OverrideStartup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("Suspended")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("MainAllocationId");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("OwnerId");
+
+ b.ToTable("Servers");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Bytes")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("ServerBackups");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("ServerVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.SharedDomain", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CloudflareId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("SharedDomains");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Subscription", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("LimitsJson")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Subscriptions");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Answer")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("IsQuestion")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsSupport")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsSystem")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("RecipientId")
+ .HasColumnType("int");
+
+ b.Property("SenderId")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RecipientId");
+
+ b.HasIndex("SenderId");
+
+ b.ToTable("SupportMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Address")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Admin")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Country")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("CurrentSubscriptionId")
+ .HasColumnType("int");
+
+ b.Property("DiscordId")
+ .HasColumnType("bigint");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("State")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("SubscriptionDuration")
+ .HasColumnType("int");
+
+ b.Property("SubscriptionSince")
+ .HasColumnType("datetime(6)");
+
+ b.Property("SupportPending")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("TokenValidTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("TotpEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("TotpSecret")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CurrentSubscriptionId");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("BaseDomain")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("PleskId")
+ .HasColumnType("int");
+
+ b.Property("PleskServerId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OwnerId");
+
+ b.HasIndex("PleskServerId");
+
+ b.ToTable("Websites");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DdosAttack", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Node", "Node")
+ .WithMany()
+ .HasForeignKey("NodeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Node");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", null)
+ .WithMany("DockerImages")
+ .HasForeignKey("ImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Domain", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+ .WithMany()
+ .HasForeignKey("OwnerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.SharedDomain", "SharedDomain")
+ .WithMany()
+ .HasForeignKey("SharedDomainId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Owner");
+
+ b.Navigation("SharedDomain");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", null)
+ .WithMany("Variables")
+ .HasForeignKey("ImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Node", null)
+ .WithMany("Allocations")
+ .HasForeignKey("NodeId");
+
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Allocations")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationAction", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Notification.NotificationClient", "NotificationClient")
+ .WithMany()
+ .HasForeignKey("NotificationClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("NotificationClient");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationClient", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.NodeAllocation", "MainAllocation")
+ .WithMany()
+ .HasForeignKey("MainAllocationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.Node", "Node")
+ .WithMany()
+ .HasForeignKey("NodeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+ .WithMany()
+ .HasForeignKey("OwnerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Image");
+
+ b.Navigation("MainAllocation");
+
+ b.Navigation("Node");
+
+ b.Navigation("Owner");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Backups")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Variables")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.User", "Recipient")
+ .WithMany()
+ .HasForeignKey("RecipientId");
+
+ b.HasOne("Moonlight.App.Database.Entities.User", "Sender")
+ .WithMany()
+ .HasForeignKey("SenderId");
+
+ b.Navigation("Recipient");
+
+ b.Navigation("Sender");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Subscription", "CurrentSubscription")
+ .WithMany()
+ .HasForeignKey("CurrentSubscriptionId");
+
+ b.Navigation("CurrentSubscription");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+ .WithMany()
+ .HasForeignKey("OwnerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.PleskServer", "PleskServer")
+ .WithMany()
+ .HasForeignKey("PleskServerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Owner");
+
+ b.Navigation("PleskServer");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Navigation("DockerImages");
+
+ b.Navigation("Variables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Navigation("Allocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Navigation("Allocations");
+
+ b.Navigation("Backups");
+
+ b.Navigation("Variables");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.cs b/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.cs
new file mode 100644
index 0000000..4c8834f
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/20230404181522_AddedPleskAndWebsiteModels.cs
@@ -0,0 +1,84 @@
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ ///
+ public partial class AddedPleskAndWebsiteModels : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "PleskServers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ApiUrl = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ApiKey = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_PleskServers", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Websites",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ BaseDomain = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ PleskId = table.Column(type: "int", nullable: false),
+ PleskServerId = table.Column(type: "int", nullable: false),
+ OwnerId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Websites", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Websites_PleskServers_PleskServerId",
+ column: x => x.PleskServerId,
+ principalTable: "PleskServers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Websites_Users_OwnerId",
+ column: x => x.OwnerId,
+ principalTable: "Users",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Websites_OwnerId",
+ table: "Websites",
+ column: "OwnerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Websites_PleskServerId",
+ table: "Websites",
+ column: "PleskServerId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Websites");
+
+ migrationBuilder.DropTable(
+ name: "PleskServers");
+ }
+ }
+}
diff --git a/Moonlight/App/Database/Migrations/20230405162507_UpdatedWebsiteModel.Designer.cs b/Moonlight/App/Database/Migrations/20230405162507_UpdatedWebsiteModel.Designer.cs
new file mode 100644
index 0000000..5d2125b
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/20230405162507_UpdatedWebsiteModel.Designer.cs
@@ -0,0 +1,954 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.App.Database;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230405162507_UpdatedWebsiteModel")]
+ partial class UpdatedWebsiteModel
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DdosAttack", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Data")
+ .HasColumnType("bigint");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("Ongoing")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NodeId");
+
+ b.ToTable("DdosAttacks");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Default")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("DockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Domain", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("SharedDomainId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OwnerId");
+
+ b.HasIndex("SharedDomainId");
+
+ b.ToTable("Domains");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Allocations")
+ .HasColumnType("int");
+
+ b.Property("ConfigFiles")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallEntrypoint")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Startup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StartupDetection")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TagsJson")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("ImageTags");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DefaultValue")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LoadingMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("LoadingMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.AuditLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("AuditLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.ErrorLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Class")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Stacktrace")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.ToTable("ErrorLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.SecurityLogEntry", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Ip")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("JsonData")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("System")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Type")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("SecurityLog");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Fqdn")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("HttpPort")
+ .HasColumnType("int");
+
+ b.Property("MoonlightDaemonPort")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SftpPort")
+ .HasColumnType("int");
+
+ b.Property("Ssl")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TokenId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Nodes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("Port")
+ .HasColumnType("int");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("NodeAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Action")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NotificationClientId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NotificationClientId");
+
+ b.ToTable("NotificationActions");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationClient", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("UserId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("NotificationClients");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.PleskServer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ApiKey")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ApiUrl")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("PleskServers");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Revoke", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Identifier")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Revokes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Cpu")
+ .HasColumnType("int");
+
+ b.Property("Disk")
+ .HasColumnType("bigint");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("int");
+
+ b.Property