Merge branch 'PleskIntegration' into main
This commit is contained in:
@@ -42,6 +42,7 @@ public class DataContext : DbContext
|
||||
public DbSet<AaPanel> AaPanels { get; set; }
|
||||
public DbSet<Website> Websites { get; set; }
|
||||
public DbSet<DdosAttack> DdosAttacks { get; set; }
|
||||
public DbSet<PleskServer> PleskServers { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
||||
9
Moonlight/App/Database/Entities/PleskServer.cs
Normal file
9
Moonlight/App/Database/Entities/PleskServer.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Moonlight.App.Database.Entities;
|
||||
|
||||
public class PleskServer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string BaseUrl { get; set; } = "";
|
||||
public string ApiKey { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
}
|
||||
@@ -3,11 +3,8 @@
|
||||
public class Website
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int InternalAaPanelId { get; set; }
|
||||
public AaPanel AaPanel { get; set; }
|
||||
public int PleskId { get; set; }
|
||||
public User Owner { get; set; }
|
||||
public string DomainName { get; set; }
|
||||
public string PhpVersion { get; set; }
|
||||
public string FtpUsername { get; set; }
|
||||
public string FtpPassword { get; set; }
|
||||
public PleskServer PleskServer { get; set; }
|
||||
public string BaseDomain { get; set; }
|
||||
}
|
||||
1085
Moonlight/App/Database/Migrations/20230322091250_AddedPleskServer.Designer.cs
generated
Normal file
1085
Moonlight/App/Database/Migrations/20230322091250_AddedPleskServer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.App.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedPleskServer : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PleskServers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
BaseUrl = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ApiKey = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PleskServers", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PleskServers");
|
||||
}
|
||||
}
|
||||
}
|
||||
1089
Moonlight/App/Database/Migrations/20230322093852_AddedNameToPleskServer.Designer.cs
generated
Normal file
1089
Moonlight/App/Database/Migrations/20230322093852_AddedNameToPleskServer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.App.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedNameToPleskServer : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Name",
|
||||
table: "PleskServers",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Name",
|
||||
table: "PleskServers");
|
||||
}
|
||||
}
|
||||
}
|
||||
1073
Moonlight/App/Database/Migrations/20230322094525_SwitchedToPleskModel.Designer.cs
generated
Normal file
1073
Moonlight/App/Database/Migrations/20230322094525_SwitchedToPleskModel.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.App.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SwitchedToPleskModel : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Websites_AaPanels_AaPanelId",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Websites_AaPanelId",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DomainName",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FtpPassword",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FtpUsername",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PhpVersion",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "InternalAaPanelId",
|
||||
table: "Websites",
|
||||
newName: "PleskServerId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "AaPanelId",
|
||||
table: "Websites",
|
||||
newName: "PleskId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Websites_PleskServerId",
|
||||
table: "Websites",
|
||||
column: "PleskServerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Websites_PleskServers_PleskServerId",
|
||||
table: "Websites",
|
||||
column: "PleskServerId",
|
||||
principalTable: "PleskServers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Websites_PleskServers_PleskServerId",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Websites_PleskServerId",
|
||||
table: "Websites");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PleskServerId",
|
||||
table: "Websites",
|
||||
newName: "InternalAaPanelId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PleskId",
|
||||
table: "Websites",
|
||||
newName: "AaPanelId");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DomainName",
|
||||
table: "Websites",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FtpPassword",
|
||||
table: "Websites",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FtpUsername",
|
||||
table: "Websites",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PhpVersion",
|
||||
table: "Websites",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Websites_AaPanelId",
|
||||
table: "Websites",
|
||||
column: "AaPanelId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Websites_AaPanels_AaPanelId",
|
||||
table: "Websites",
|
||||
column: "AaPanelId",
|
||||
principalTable: "AaPanels",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
1077
Moonlight/App/Database/Migrations/20230323084631_AddedBaseDomainToWebsite.Designer.cs
generated
Normal file
1077
Moonlight/App/Database/Migrations/20230323084631_AddedBaseDomainToWebsite.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.App.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedBaseDomainToWebsite : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "BaseDomain",
|
||||
table: "Websites",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BaseDomain",
|
||||
table: "Websites");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,6 +446,29 @@ namespace Moonlight.App.Database.Migrations
|
||||
b.ToTable("NotificationClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Moonlight.App.Database.Entities.PleskServer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ApiKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("BaseUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PleskServers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Moonlight.App.Database.Entities.Revoke", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -787,37 +810,25 @@ namespace Moonlight.App.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AaPanelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DomainName")
|
||||
b.Property<string>("BaseDomain")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FtpPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("FtpUsername")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("InternalAaPanelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PhpVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
b.Property<int>("PleskId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PleskServerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AaPanelId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("PleskServerId");
|
||||
|
||||
b.ToTable("Websites");
|
||||
});
|
||||
|
||||
@@ -1007,21 +1018,21 @@ namespace Moonlight.App.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
|
||||
{
|
||||
b.HasOne("Moonlight.App.Database.Entities.AaPanel", "AaPanel")
|
||||
.WithMany()
|
||||
.HasForeignKey("AaPanelId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AaPanel");
|
||||
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 =>
|
||||
|
||||
Reference in New Issue
Block a user