Added missing relations to server db model. Started with server crud. Removed unused relations from detail responses

This commit is contained in:
2024-12-17 22:52:09 +01:00
parent 747712c5c4
commit a34a3ba8b4
20 changed files with 1131 additions and 40 deletions

View File

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

View File

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