Refactored project to module structure
This commit is contained in:
18
Moonlight.Shared/Admin/Setup/ApplySetupDto.cs
Normal file
18
Moonlight.Shared/Admin/Setup/ApplySetupDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Setup;
|
||||
|
||||
public class ApplySetupDto
|
||||
{
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(32)]
|
||||
public string AdminUsername { get; set; }
|
||||
|
||||
[Required] [EmailAddress] public string AdminEmail { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(8)]
|
||||
[MaxLength(64)]
|
||||
public string AdminPassword { get; set; }
|
||||
}
|
||||
11
Moonlight.Shared/Admin/Sys/ApiKeys/ApiKeyDto.cs
Normal file
11
Moonlight.Shared/Admin/Sys/ApiKeys/ApiKeyDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
|
||||
public record ApiKeyDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string Description,
|
||||
string[] Permissions,
|
||||
DateTimeOffset ValidUntil,
|
||||
string Key,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt);
|
||||
12
Moonlight.Shared/Admin/Sys/ApiKeys/CreateApiKeyDto.cs
Normal file
12
Moonlight.Shared/Admin/Sys/ApiKeys/CreateApiKeyDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
|
||||
public class CreateApiKeyDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
[MaxLength(300)] public string Description { get; set; } = "";
|
||||
|
||||
[Required] public DateTimeOffset ValidUntil { get; set; }
|
||||
[Required] public string[] Permissions { get; set; }
|
||||
}
|
||||
12
Moonlight.Shared/Admin/Sys/ApiKeys/UpdateApiKeyDto.cs
Normal file
12
Moonlight.Shared/Admin/Sys/ApiKeys/UpdateApiKeyDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
|
||||
public class UpdateApiKeyDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
[MaxLength(300)] public string Description { get; set; } = "";
|
||||
|
||||
[Required] public DateTimeOffset ValidUntil { get; set; }
|
||||
[Required] public string[] Permissions { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public record ContainerHelperStatusDto(bool IsEnabled, bool IsReachable);
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public struct RebuildEventDto
|
||||
{
|
||||
[JsonPropertyName("type")] public RebuildEventType Type { get; set; }
|
||||
|
||||
[JsonPropertyName("data")] public string Data { get; set; }
|
||||
}
|
||||
|
||||
public enum RebuildEventType
|
||||
{
|
||||
Log = 0,
|
||||
Failed = 1,
|
||||
Succeeded = 2,
|
||||
Step = 3
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public class RequestRebuildDto
|
||||
{
|
||||
public RequestRebuildDto()
|
||||
{
|
||||
}
|
||||
|
||||
public RequestRebuildDto(bool noBuildCache)
|
||||
{
|
||||
NoBuildCache = noBuildCache;
|
||||
}
|
||||
|
||||
public bool NoBuildCache { get; set; }
|
||||
}
|
||||
10
Moonlight.Shared/Admin/Sys/ContainerHelper/SetVersionDto.cs
Normal file
10
Moonlight.Shared/Admin/Sys/ContainerHelper/SetVersionDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public class SetVersionDto
|
||||
{
|
||||
[Required]
|
||||
[RegularExpression(@"^(?!\/|.*\/\/|.*\.\.|.*\/$)[A-Za-z0-9._/-]+$", ErrorMessage = "Invalid version format")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
17
Moonlight.Shared/Admin/Sys/Diagnose/DiagnoseResultDto.cs
Normal file
17
Moonlight.Shared/Admin/Sys/Diagnose/DiagnoseResultDto.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.Diagnose;
|
||||
|
||||
public record DiagnoseResultDto(
|
||||
DiagnoseLevel Level,
|
||||
string Title,
|
||||
string[] Tags,
|
||||
string? Message,
|
||||
string? StackStrace,
|
||||
string? SolutionUrl,
|
||||
string? ReportUrl);
|
||||
|
||||
public enum DiagnoseLevel
|
||||
{
|
||||
Error = 0,
|
||||
Warning = 1,
|
||||
Healthy = 2
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.Settings;
|
||||
|
||||
public class SetWhiteLabelingDto
|
||||
{
|
||||
[Required] public string Name { get; set; }
|
||||
}
|
||||
6
Moonlight.Shared/Admin/Sys/Settings/WhiteLabelingDto.cs
Normal file
6
Moonlight.Shared/Admin/Sys/Settings/WhiteLabelingDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.Settings;
|
||||
|
||||
public class WhiteLabelingDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
9
Moonlight.Shared/Admin/Sys/SystemInfoDto.cs
Normal file
9
Moonlight.Shared/Admin/Sys/SystemInfoDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Moonlight.Shared.Admin.Sys;
|
||||
|
||||
public record SystemInfoDto(
|
||||
double CpuUsage,
|
||||
long MemoryUsage,
|
||||
string OperatingSystem,
|
||||
TimeSpan Uptime,
|
||||
string VersionName,
|
||||
bool IsUpToDate);
|
||||
16
Moonlight.Shared/Admin/Sys/Themes/CreateThemeDto.cs
Normal file
16
Moonlight.Shared/Admin/Sys/Themes/CreateThemeDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.Themes;
|
||||
|
||||
public class CreateThemeDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
|
||||
[Required] [MaxLength(30)] public string Version { get; set; }
|
||||
|
||||
[Required] [MaxLength(30)] public string Author { get; set; }
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[Required] [MaxLength(20_000)] public string CssContent { get; set; }
|
||||
}
|
||||
3
Moonlight.Shared/Admin/Sys/Themes/ThemeDto.cs
Normal file
3
Moonlight.Shared/Admin/Sys/Themes/ThemeDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.Themes;
|
||||
|
||||
public record ThemeDto(int Id, string Name, string Author, string Version, string CssContent, bool IsEnabled);
|
||||
16
Moonlight.Shared/Admin/Sys/Themes/UpdateThemeDto.cs
Normal file
16
Moonlight.Shared/Admin/Sys/Themes/UpdateThemeDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Sys.Themes;
|
||||
|
||||
public class UpdateThemeDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
|
||||
[Required] [MaxLength(30)] public string Version { get; set; }
|
||||
|
||||
[Required] [MaxLength(30)] public string Author { get; set; }
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[Required] [MaxLength(20_000)] public string CssContent { get; set; }
|
||||
}
|
||||
3
Moonlight.Shared/Admin/Sys/Versions/VersionDto.cs
Normal file
3
Moonlight.Shared/Admin/Sys/Versions/VersionDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Moonlight.Shared.Admin.Sys.Versions;
|
||||
|
||||
public record VersionDto(string Identifier, bool IsPreRelease, bool IsDevelopment, DateTimeOffset CreatedAt);
|
||||
12
Moonlight.Shared/Admin/Users/Roles/CreateRoleDto.cs
Normal file
12
Moonlight.Shared/Admin/Users/Roles/CreateRoleDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Users.Roles;
|
||||
|
||||
public class CreateRoleDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
|
||||
[MaxLength(300)] public string Description { get; set; } = "";
|
||||
|
||||
[Required] public string[] Permissions { get; set; }
|
||||
}
|
||||
10
Moonlight.Shared/Admin/Users/Roles/RoleDto.cs
Normal file
10
Moonlight.Shared/Admin/Users/Roles/RoleDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Moonlight.Shared.Admin.Users.Roles;
|
||||
|
||||
public record RoleDto(
|
||||
int Id,
|
||||
string Name,
|
||||
string Description,
|
||||
string[] Permissions,
|
||||
int MemberCount,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt);
|
||||
12
Moonlight.Shared/Admin/Users/Roles/UpdateRoleDto.cs
Normal file
12
Moonlight.Shared/Admin/Users/Roles/UpdateRoleDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Users.Roles;
|
||||
|
||||
public class UpdateRoleDto
|
||||
{
|
||||
[Required] [MaxLength(30)] public string Name { get; set; }
|
||||
|
||||
[MaxLength(300)] public string Description { get; set; } = "";
|
||||
|
||||
[Required] public string[] Permissions { get; set; }
|
||||
}
|
||||
13
Moonlight.Shared/Admin/Users/Users/CreateUserDto.cs
Normal file
13
Moonlight.Shared/Admin/Users/Users/CreateUserDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public class CreateUserDto
|
||||
{
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(32)]
|
||||
public string Username { get; set; }
|
||||
|
||||
[Required] [EmailAddress] public string Email { get; set; }
|
||||
}
|
||||
13
Moonlight.Shared/Admin/Users/Users/UpdateUserDto.cs
Normal file
13
Moonlight.Shared/Admin/Users/Users/UpdateUserDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public class UpdateUserDto
|
||||
{
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
[MaxLength(32)]
|
||||
public string Username { get; set; }
|
||||
|
||||
[Required] [EmailAddress] public string Email { get; set; }
|
||||
}
|
||||
3
Moonlight.Shared/Admin/Users/Users/UserDto.cs
Normal file
3
Moonlight.Shared/Admin/Users/Users/UserDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public record UserDto(int Id, string Username, string Email, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);
|
||||
Reference in New Issue
Block a user