Created some request models. Started building create star form together

This commit is contained in:
2024-12-05 22:17:57 +01:00
parent 291b80cc60
commit 1520d0b2b1
15 changed files with 247 additions and 7 deletions

View File

@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using MoonlightServers.Shared.Enums;
using MoonlightServers.Shared.Interfaces;
namespace MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
public class CreateStarVariableRequest : IStarVariable
{
[Required(ErrorMessage = "You need to specify a variable name")]
public string Name { get; set; }
[Required(ErrorMessage = "You need to specify a variable description", AllowEmptyStrings = true)]
public string Description { get; set; } = "";
[Required(ErrorMessage = "You need to specify a variable key")]
public string Key { get; set; }
[Required(ErrorMessage = "You need to specify a variable default value", AllowEmptyStrings = true)]
public string DefaultValue { get; set; } = "";
public bool AllowViewing { get; set; }
public bool AllowEditing { get; set; }
public StarVariableType Type { get; set; } = StarVariableType.Text;
public string? Filter { get; set; } = null;
}

View File

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using MoonlightServers.Shared.Http.Requests.Admin.StarVariables;
namespace MoonlightServers.Shared.Http.Requests.Admin.Stars;
@@ -42,4 +43,6 @@ public class CreateStarRequest
[Required(ErrorMessage = "You need to provide parse configuration")]
public string ParseConfiguration { get; set; } = "[]";
public List<CreateStarVariableRequest> Variables { get; set; } = new();
}

View File

@@ -0,0 +1,20 @@
using MoonlightServers.Shared.Enums;
namespace MoonlightServers.Shared.Interfaces;
public interface IStarVariable // For a common abstraction between create and update model to use in a shared form component
{
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; }
}