Added missing relations to server db model. Started with server crud. Removed unused relations from detail responses
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Servers;
|
||||
|
||||
public class CreateServerRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name for the server")]
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid cpu percent amount")]
|
||||
public int Cpu { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid memory amount")]
|
||||
public int Memory { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid disk amount")]
|
||||
public int Disk { get; set; }
|
||||
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
|
||||
[Range(0, int.MaxValue, ErrorMessage = "You need to provide a valid bandwidth amount")]
|
||||
public int Bandwidth { get; set; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
public int StarId { get; set; }
|
||||
|
||||
public int NodeId { get; set; }
|
||||
|
||||
public int[] AllocationIds { get; set; } = [];
|
||||
public Dictionary<string, string> Variables { get; set; } = new();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Requests.Admin.Servers;
|
||||
|
||||
public class UpdateServerRequest
|
||||
{
|
||||
[Required(ErrorMessage = "You need to provide a name for the server")]
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid cpu percent amount")]
|
||||
public int Cpu { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid memory amount")]
|
||||
public int Memory { get; set; }
|
||||
|
||||
[Range(1, int.MaxValue, ErrorMessage = "You need to provide a valid disk amount")]
|
||||
public int Disk { get; set; }
|
||||
|
||||
public bool UseVirtualDisk { get; set; }
|
||||
|
||||
[Range(0, int.MaxValue, ErrorMessage = "You need to provide a valid bandwidth amount")]
|
||||
public int Bandwidth { get; set; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
public int StarId { get; set; }
|
||||
|
||||
public int NodeId { get; set; }
|
||||
|
||||
public int[] AllocationIds { get; set; } = [];
|
||||
public Dictionary<string, string> Variables { get; set; } = new();
|
||||
}
|
||||
@@ -5,9 +5,6 @@ namespace MoonlightServers.Shared.Http.Responses.Admin.Nodes;
|
||||
public class NodeDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
//public List<Server> Servers { get; set; } = new();
|
||||
public NodeAllocationDetailResponse[] Allocations { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
||||
|
||||
public class ServerVariableDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.NodeAllocations;
|
||||
using MoonlightServers.Shared.Http.Responses.Admin.ServerVariables;
|
||||
|
||||
namespace MoonlightServers.Shared.Http.Responses.Admin.Servers;
|
||||
|
||||
public class ServerDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
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; }
|
||||
|
||||
public string? StartupOverride { get; set; }
|
||||
|
||||
public int DockerImageIndex { get; set; }
|
||||
|
||||
public int StarId { get; set; }
|
||||
|
||||
public int NodeId { get; set; }
|
||||
}
|
||||
@@ -6,10 +6,6 @@ namespace MoonlightServers.Shared.Http.Responses.Admin.Stars;
|
||||
public class StarDetailResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// References
|
||||
public StarVariableDetailResponse[] Variables { get; set; }
|
||||
public StarDockerImageDetailResponse[] DockerImages { get; set; }
|
||||
|
||||
// Meta
|
||||
public string Name { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user