Implemented db entities. Adjusted template default values
This commit is contained in:
13
MoonlightServers.ApiServer/Database/Entities/Allocation.cs
Normal file
13
MoonlightServers.ApiServer/Database/Entities/Allocation.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Allocation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// Relations
|
||||
public Node Node { get; set; }
|
||||
public Server? Server { get; set; }
|
||||
|
||||
public string IpAddress { get; set; }
|
||||
public int Port { get; set; }
|
||||
}
|
||||
23
MoonlightServers.ApiServer/Database/Entities/Node.cs
Normal file
23
MoonlightServers.ApiServer/Database/Entities/Node.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class Node
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// Relations
|
||||
public List<Server> Servers { get; set; } = new();
|
||||
public List<Allocation> Allocations { get; set; } = new();
|
||||
|
||||
// Meta
|
||||
public string Name { get; set; }
|
||||
|
||||
// Connection details
|
||||
public string Fqdn { get; set; }
|
||||
public string Token { get; set; }
|
||||
public int HttpPort { get; set; }
|
||||
public int FtpPort { get; set; }
|
||||
|
||||
// Misc
|
||||
public bool EnableTransparentMode { get; set; }
|
||||
public bool EnableDynamicFirewall { get; set; }
|
||||
}
|
||||
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; }
|
||||
|
||||
// Relations
|
||||
public Star Star { get; set; }
|
||||
public Node Node { get; set; }
|
||||
public List<Allocation> Allocations { get; set; } = new();
|
||||
|
||||
// Meta
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
// Star specific stuff
|
||||
public string? StartupOverride { get; set; }
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
// Resources and limits
|
||||
public int Cpu { get; set; }
|
||||
public int Memory { get; set; }
|
||||
public int Disk { get; set; }
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
public int Bandwidth { get; set; }
|
||||
}
|
||||
13
MoonlightServers.ApiServer/Database/Entities/ServerBackup.cs
Normal file
13
MoonlightServers.ApiServer/Database/Entities/ServerBackup.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class ServerBackup
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime CompletedAt { get; set; }
|
||||
|
||||
public long Size { get; set; }
|
||||
public bool Successful { get; set; }
|
||||
public bool Completed { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class ServerVariable
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// Relations
|
||||
public Server Server { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string Value { 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; }
|
||||
|
||||
// References
|
||||
public List<StarVariable> Variables { get; set; } = new();
|
||||
public List<StarDockerImage> DockerImages { get; set; } = new();
|
||||
|
||||
// Meta
|
||||
public string Name { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string? UpdateUrl { get; set; }
|
||||
public string? DonateUrl { get; set; }
|
||||
|
||||
// Start and stop
|
||||
public string StartupCommand { get; set; }
|
||||
public string StopCommand { get; set; }
|
||||
public string OnlineDetection { get; set; }
|
||||
|
||||
// Install
|
||||
public string InstallShell { get; set; }
|
||||
public string InstallDockerImage { get; set; }
|
||||
public string InstallScript { get; set; }
|
||||
|
||||
// Misc
|
||||
public int RequiredAllocations { get; set; }
|
||||
public bool AllowDockerImageChange { get; set; }
|
||||
public string ParseConfiguration { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class StarDockerImage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Star Star { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public bool AutoPulling { get; set; }
|
||||
}
|
||||
21
MoonlightServers.ApiServer/Database/Entities/StarVariable.cs
Normal file
21
MoonlightServers.ApiServer/Database/Entities/StarVariable.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using MoonlightServers.Shared.Enums;
|
||||
|
||||
namespace MoonlightServers.ApiServer.Database.Entities;
|
||||
|
||||
public class StarVariable
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Star Star { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public bool AllowViewing { get; set; }
|
||||
public bool AllowEditing { get; set; }
|
||||
|
||||
public StarVariableType Type { get; set; }
|
||||
public string? Filter { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user