Added database entities, started with node crud
This commit is contained in:
12
MoonlightServers.ApiServer/Database/Entities/Allocation.cs
Normal file
12
MoonlightServers.ApiServer/Database/Entities/Allocation.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Allocation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string IpAddress { get; set; } = "0.0.0.0";
|
||||
public int Port { get; set; }
|
||||
|
||||
public Server? Server { get; set; }
|
||||
public Node Node { get; set; }
|
||||
}
|
||||
18
MoonlightServers.ApiServer/Database/Entities/Backup.cs
Normal file
18
MoonlightServers.ApiServer/Database/Entities/Backup.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Backup
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public BackupState State { get; set; }
|
||||
|
||||
public long Size { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime FinishedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public Server Server { get; set; }
|
||||
}
|
||||
11
MoonlightServers.ApiServer/Database/Entities/Network.cs
Normal file
11
MoonlightServers.ApiServer/Database/Entities/Network.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Network
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public Node Node { get; set; }
|
||||
public List<Server> Servers { get; set; } = new();
|
||||
}
|
||||
16
MoonlightServers.ApiServer/Database/Entities/Node.cs
Normal file
16
MoonlightServers.ApiServer/Database/Entities/Node.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Node
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Fqdn { get; set; }
|
||||
public int ApiPort { get; set; }
|
||||
public string Token { get; set; }
|
||||
public bool SslEnabled { get; set; }
|
||||
|
||||
public List<Allocation> Allocations { get; set; } = new();
|
||||
public List<Server> Servers { get; set; } = new();
|
||||
}
|
||||
26
MoonlightServers.ApiServer/Database/Entities/Server.cs
Normal file
26
MoonlightServers.ApiServer/Database/Entities/Server.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Server
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Cpu { get; set; }
|
||||
public int Memory { get; set; }
|
||||
public int Disk { get; set; }
|
||||
|
||||
public string? OverrideStartupCommand { get; set; } = null;
|
||||
public string? OverrideDockerImage { get; set; } = null;
|
||||
|
||||
public bool VirtualDiskEnabled { get; set; } = false;
|
||||
|
||||
public Star Star { get; set; }
|
||||
public int DockerImageIndex { get; set; } = 0;
|
||||
|
||||
public Node Node { get; set; }
|
||||
public Network? Network { get; set; }
|
||||
public List<Allocation> Allocations { get; set; } = new();
|
||||
public List<ServerVariable> Variables { get; set; } = new();
|
||||
public List<Backup> Backups { get; set; } = new();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class ServerVariable
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public Server Server { get; set; }
|
||||
}
|
||||
31
MoonlightServers.ApiServer/Database/Entities/Star.cs
Normal file
31
MoonlightServers.ApiServer/Database/Entities/Star.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Star
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Author { get; set; }
|
||||
|
||||
public string? DonationUrl { get; set; }
|
||||
public string? UpdateUrl { get; set; }
|
||||
|
||||
public string StartupCommand { get; set; }
|
||||
public string StopCommand { get; set; }
|
||||
public string OnlineDetection { get; set; }
|
||||
|
||||
public string InstallShell { get; set; }
|
||||
public string InstallDockerImage { get; set; }
|
||||
public string InstallScript { get; set; }
|
||||
public int RequiredAllocations { get; set; }
|
||||
|
||||
public string ParseConfiguration { get; set; }
|
||||
|
||||
public int DefaultDockerImageIndex { get; set; }
|
||||
public bool AllowDockerImageChanging { get; set; }
|
||||
|
||||
public List<StarVariable> Variables { get; set; } = new();
|
||||
public List<StarDockerImage> DockerImages { get; set; } = new();
|
||||
|
||||
public StarFolder? Folder { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class StarDockerImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Identifier { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public bool AutoPulling { get; set; } = true;
|
||||
}
|
||||
10
MoonlightServers.ApiServer/Database/Entities/StarFolder.cs
Normal file
10
MoonlightServers.ApiServer/Database/Entities/StarFolder.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class StarFolder
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<Star> Stars { get; set; } = new();
|
||||
}
|
||||
20
MoonlightServers.ApiServer/Database/Entities/StarVariable.cs
Normal file
20
MoonlightServers.ApiServer/Database/Entities/StarVariable.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class StarVariable
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public bool AllowViewing { get; set; } = false;
|
||||
public bool AllowEditing { get; set; } = false;
|
||||
|
||||
public string? Filter { get; set; }
|
||||
public StarVariableType Type { get; set; } = StarVariableType.Text;
|
||||
}
|
||||
Reference in New Issue
Block a user