Implemented db entities. Adjusted template default values

This commit is contained in:
2024-12-05 16:49:47 +01:00
parent 3392407890
commit 3b77b3df1e
21 changed files with 1385 additions and 75 deletions

View 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; }
}

View 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; }
}

View 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; }
}

View 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; }
}

View File

@@ -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; }
}

View 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; }
}

View File

@@ -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; }
}

View 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; }
}