Implemented template crud, db entities, import/export, ptero and pelican import
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class CreateDockerImageDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string ImageName { get; set; } = string.Empty;
|
||||
|
||||
public bool SkipPulling { get; set; }
|
||||
}
|
||||
24
MoonlightServers.Shared/Admin/Templates/CreateTemplateDto.cs
Normal file
24
MoonlightServers.Shared/Admin/Templates/CreateTemplateDto.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class CreateTemplateDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(30)]
|
||||
public string Author { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(30)]
|
||||
public string Version { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(2048)]
|
||||
public string? UpdateUrl { get; set; }
|
||||
|
||||
[MaxLength(2048)]
|
||||
public string? DonateUrl { get; set; }
|
||||
}
|
||||
18
MoonlightServers.Shared/Admin/Templates/CreateVariableDto.cs
Normal file
18
MoonlightServers.Shared/Admin/Templates/CreateVariableDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class CreateVariableDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(60)]
|
||||
public string EnvName { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(1024)]
|
||||
public string? DefaultValue { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record DetailedTemplateDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string Description,
|
||||
string Author,
|
||||
string Version,
|
||||
string? UpdateUrl,
|
||||
string? DonateUrl,
|
||||
FilesConfigDto FilesConfig,
|
||||
LifecycleConfigDto LifecycleConfig,
|
||||
InstallationConfigDto InstallationConfig,
|
||||
MiscellaneousConfigDto MiscellaneousConfig,
|
||||
bool AllowUserDockerImageChange,
|
||||
int? DefaultDockerImageId
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record DockerImageDto(
|
||||
int Id,
|
||||
string DisplayName,
|
||||
string ImageName,
|
||||
bool SkipPulling
|
||||
);
|
||||
20
MoonlightServers.Shared/Admin/Templates/FilesConfigDto.cs
Normal file
20
MoonlightServers.Shared/Admin/Templates/FilesConfigDto.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class FilesConfigDto
|
||||
{
|
||||
public List<ConfigurationFileDto> ConfigurationFiles { get; set; } = new();
|
||||
}
|
||||
|
||||
public class ConfigurationFileDto
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string Parser { get; set; }
|
||||
|
||||
public List<ConfigurationFileMappingDto> Mappings { get; set; } = new();
|
||||
}
|
||||
|
||||
public class ConfigurationFileMappingDto
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record InstallationConfigDto(string DockerImage, string Shell, string Script);
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record LifecycleConfigDto(StartupCommandDto[] StartupCommands, string StopCommand, string[] OnlineLogPatterns);
|
||||
public record StartupCommandDto(string DisplayName, string Command);
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record MiscellaneousConfigDto(bool UseLegacyStartup);
|
||||
11
MoonlightServers.Shared/Admin/Templates/TemplateDto.cs
Normal file
11
MoonlightServers.Shared/Admin/Templates/TemplateDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record TemplateDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string Description,
|
||||
string Author,
|
||||
string Version,
|
||||
string? UpdateUrl,
|
||||
string? DonateUrl
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateDockerImageDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string ImageName { get; set; } = string.Empty;
|
||||
|
||||
public bool SkipPulling { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateFilesConfigDto
|
||||
{
|
||||
public List<UpdateConfigurationFileDto> ConfigurationFiles { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UpdateConfigurationFileDto
|
||||
{
|
||||
[Required]
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Parser { get; set; } = string.Empty;
|
||||
|
||||
public List<UpdateConfigurationFileMappingDto> Mappings { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UpdateConfigurationFileMappingDto
|
||||
{
|
||||
[Required]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
public string? Value { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateInstallationConfigDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string Shell { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string DockerImage { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Script { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateLifecycleConfigDto
|
||||
{
|
||||
public List<UpdateStartupCommandDto> StartupCommands { get; set; } = [];
|
||||
|
||||
[Required]
|
||||
public string StopCommand { get; set; } = string.Empty;
|
||||
|
||||
public List<string> OnlineLogPatterns { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UpdateStartupCommandDto
|
||||
{
|
||||
[Required]
|
||||
public string Command { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateMiscellaneousConfigDto
|
||||
{
|
||||
public bool UseLegacyStartup { get; set; }
|
||||
}
|
||||
32
MoonlightServers.Shared/Admin/Templates/UpdateTemplateDto.cs
Normal file
32
MoonlightServers.Shared/Admin/Templates/UpdateTemplateDto.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateTemplateDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(30)]
|
||||
public string Author { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(30)]
|
||||
public string Version { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(2048)]
|
||||
public string? UpdateUrl { get; set; }
|
||||
|
||||
[MaxLength(2048)]
|
||||
public string? DonateUrl { get; set; }
|
||||
|
||||
public UpdateFilesConfigDto FilesConfig { get; set; } = new();
|
||||
public UpdateLifecycleConfigDto LifecycleConfig { get; set; } = new();
|
||||
public UpdateInstallationConfigDto InstallationConfig { get; set; } = new();
|
||||
public UpdateMiscellaneousConfigDto MiscellaneousConfig { get; set; } = new();
|
||||
|
||||
public bool AllowUserDockerImageChange { get; set; }
|
||||
public int? DefaultDockerImageId { get; set; }
|
||||
}
|
||||
18
MoonlightServers.Shared/Admin/Templates/UpdateVariableDto.cs
Normal file
18
MoonlightServers.Shared/Admin/Templates/UpdateVariableDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public class UpdateVariableDto
|
||||
{
|
||||
[Required, MaxLength(30)]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Required, MaxLength(60)]
|
||||
public string EnvName { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(1024)]
|
||||
public string? DefaultValue { get; set; } = string.Empty;
|
||||
}
|
||||
9
MoonlightServers.Shared/Admin/Templates/VariableDto.cs
Normal file
9
MoonlightServers.Shared/Admin/Templates/VariableDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MoonlightServers.Shared.Admin.Templates;
|
||||
|
||||
public record VariableDto(
|
||||
int Id,
|
||||
string DisplayName,
|
||||
string Description,
|
||||
string EnvName,
|
||||
string DefaultValue
|
||||
);
|
||||
Reference in New Issue
Block a user