Created some request models. Started building create star form together
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
20
MoonlightServers.Shared/Interfaces/IStarVariable.cs
Normal file
20
MoonlightServers.Shared/Interfaces/IStarVariable.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user