Refactored project to module structure
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Seup;
|
||||
namespace Moonlight.Shared.Admin.Setup;
|
||||
|
||||
public class ApplySetupDto
|
||||
{
|
||||
@@ -8,11 +8,9 @@ public class ApplySetupDto
|
||||
[MinLength(3)]
|
||||
[MaxLength(32)]
|
||||
public string AdminUsername { get; set; }
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string AdminEmail { get; set; }
|
||||
|
||||
|
||||
[Required] [EmailAddress] public string AdminEmail { get; set; }
|
||||
|
||||
[Required]
|
||||
[MinLength(8)]
|
||||
[MaxLength(64)]
|
||||
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);
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.ApiKeys;
|
||||
namespace Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
|
||||
public class CreateApiKeyDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.ApiKeys;
|
||||
namespace Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
|
||||
public class UpdateApiKeyDto
|
||||
{
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin;
|
||||
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
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.ContainerHelper;
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public class RequestRebuildDto
|
||||
{
|
||||
public bool NoBuildCache { get; set; }
|
||||
|
||||
public RequestRebuildDto()
|
||||
{
|
||||
}
|
||||
@@ -12,4 +10,6 @@ public class RequestRebuildDto
|
||||
{
|
||||
NoBuildCache = noBuildCache;
|
||||
}
|
||||
|
||||
public bool NoBuildCache { get; set; }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.ContainerHelper;
|
||||
namespace Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
|
||||
public class SetVersionDto
|
||||
{
|
||||
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; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Settings;
|
||||
namespace Moonlight.Shared.Admin.Sys.Settings;
|
||||
|
||||
public class WhiteLabelingDto
|
||||
{
|
||||
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; }
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Themes;
|
||||
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; }
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin;
|
||||
namespace Moonlight.Shared.Admin.Sys.Versions;
|
||||
|
||||
public record VersionDto(string Identifier, bool IsPreRelease, bool IsDevelopment, DateTimeOffset CreatedAt);
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.Roles;
|
||||
namespace Moonlight.Shared.Admin.Users.Roles;
|
||||
|
||||
public class CreateRoleDto
|
||||
{
|
||||
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);
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.Roles;
|
||||
namespace Moonlight.Shared.Admin.Users.Roles;
|
||||
|
||||
public class UpdateRoleDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.Users;
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public class CreateUserDto
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.Users;
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public class UpdateUserDto
|
||||
{
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Users;
|
||||
namespace Moonlight.Shared.Admin.Users.Users;
|
||||
|
||||
public record UserDto(int Id, string Username, string Email, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Moonlight.Shared.Http.Events;
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.Settings;
|
||||
|
||||
public class SetWhiteLabelingDto
|
||||
{
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.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; }
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests.Admin.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; }
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.ApiKeys;
|
||||
|
||||
public record ApiKeyDto(int Id, string Name, string Description, string[] Permissions, DateTimeOffset ValidUntil, string Key, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);
|
||||
@@ -1,3 +0,0 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Auth;
|
||||
|
||||
public record ClaimDto(string Type, string Value);
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin;
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin;
|
||||
|
||||
public record RoleDto(int Id, string Name, string Description, string[] Permissions, int MemberCount, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);
|
||||
@@ -1,3 +0,0 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin;
|
||||
|
||||
public record SystemInfoDto(double CpuUsage, long MemoryUsage, string OperatingSystem, TimeSpan Uptime, string VersionName, bool IsUpToDate);
|
||||
@@ -17,5 +17,9 @@
|
||||
<RepositoryUrl>https://git.battlestati.one/Moonlight-Panel/Moonlight</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Client\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -4,53 +4,53 @@ public static class Permissions
|
||||
{
|
||||
public const string Prefix = "Permissions:";
|
||||
public const string ClaimType = "Permissions";
|
||||
|
||||
|
||||
public static class Users
|
||||
{
|
||||
private const string Section = "Users";
|
||||
|
||||
|
||||
public const string View = $"{Prefix}{Section}.{nameof(View)}";
|
||||
public const string Edit = $"{Prefix}{Section}.{nameof(Edit)}";
|
||||
public const string Create = $"{Prefix}{Section}.{nameof(Create)}";
|
||||
public const string Delete = $"{Prefix}{Section}.{nameof(Delete)}";
|
||||
public const string Logout = $"{Prefix}{Section}.{nameof(Logout)}";
|
||||
}
|
||||
|
||||
|
||||
public static class ApiKeys
|
||||
{
|
||||
private const string Section = "ApiKeys";
|
||||
|
||||
|
||||
public const string View = $"{Prefix}{Section}.{nameof(View)}";
|
||||
public const string Edit = $"{Prefix}{Section}.{nameof(Edit)}";
|
||||
public const string Create = $"{Prefix}{Section}.{nameof(Create)}";
|
||||
public const string Delete = $"{Prefix}{Section}.{nameof(Delete)}";
|
||||
}
|
||||
|
||||
|
||||
public static class Roles
|
||||
{
|
||||
private const string Section = "Roles";
|
||||
|
||||
|
||||
public const string View = $"{Prefix}{Section}.{nameof(View)}";
|
||||
public const string Edit = $"{Prefix}{Section}.{nameof(Edit)}";
|
||||
public const string Create = $"{Prefix}{Section}.{nameof(Create)}";
|
||||
public const string Delete = $"{Prefix}{Section}.{nameof(Delete)}";
|
||||
public const string Members = $"{Prefix}{Section}.{nameof(Members)}";
|
||||
}
|
||||
|
||||
|
||||
public static class Themes
|
||||
{
|
||||
private const string Section = "Themes";
|
||||
|
||||
|
||||
public const string View = $"{Prefix}{Section}.{nameof(View)}";
|
||||
public const string Edit = $"{Prefix}{Section}.{nameof(Edit)}";
|
||||
public const string Create = $"{Prefix}{Section}.{nameof(Create)}";
|
||||
public const string Delete = $"{Prefix}{Section}.{nameof(Delete)}";
|
||||
}
|
||||
|
||||
|
||||
public static class System
|
||||
{
|
||||
private const string Section = "System";
|
||||
|
||||
|
||||
public const string Info = $"{Prefix}{Section}.{nameof(Info)}";
|
||||
public const string Diagnose = $"{Prefix}{Section}.{nameof(Diagnose)}";
|
||||
public const string Versions = $"{Prefix}{Section}.{nameof(Versions)}";
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Moonlight.Shared.Http.Events;
|
||||
using Moonlight.Shared.Http.Requests.Admin.ApiKeys;
|
||||
using Moonlight.Shared.Http.Requests.Admin.ContainerHelper;
|
||||
using Moonlight.Shared.Http.Requests.Admin.Roles;
|
||||
using Moonlight.Shared.Http.Requests.Admin.Settings;
|
||||
using Moonlight.Shared.Http.Requests.Admin.Themes;
|
||||
using Moonlight.Shared.Http.Requests.Admin.Users;
|
||||
using Moonlight.Shared.Http.Responses;
|
||||
using Moonlight.Shared.Http.Responses.Admin;
|
||||
using Moonlight.Shared.Http.Responses.Admin.ApiKeys;
|
||||
using Moonlight.Shared.Http.Responses.Admin.Auth;
|
||||
using Moonlight.Shared.Http.Responses.Admin.Settings;
|
||||
using Moonlight.Shared.Http.Responses.Admin.Themes;
|
||||
using Moonlight.Shared.Http.Responses.Admin.Users;
|
||||
using Moonlight.Shared.Admin.Sys;
|
||||
using Moonlight.Shared.Admin.Sys.ApiKeys;
|
||||
using Moonlight.Shared.Admin.Sys.ContainerHelper;
|
||||
using Moonlight.Shared.Admin.Sys.Diagnose;
|
||||
using Moonlight.Shared.Admin.Sys.Settings;
|
||||
using Moonlight.Shared.Admin.Sys.Themes;
|
||||
using Moonlight.Shared.Admin.Sys.Versions;
|
||||
using Moonlight.Shared.Admin.Users.Roles;
|
||||
using Moonlight.Shared.Admin.Users.Users;
|
||||
using Moonlight.Shared.Shared;
|
||||
using Moonlight.Shared.Shared.Auth;
|
||||
|
||||
namespace Moonlight.Shared.Http;
|
||||
namespace Moonlight.Shared;
|
||||
|
||||
// Users
|
||||
[JsonSerializable(typeof(CreateUserDto))]
|
||||
@@ -64,9 +61,7 @@ namespace Moonlight.Shared.Http;
|
||||
// Settings - White Labeling
|
||||
[JsonSerializable(typeof(WhiteLabelingDto))]
|
||||
[JsonSerializable(typeof(SetWhiteLabelingDto))]
|
||||
|
||||
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
|
||||
public partial class SerializationContext : JsonSerializerContext
|
||||
{
|
||||
|
||||
}
|
||||
3
Moonlight.Shared/Shared/Auth/ClaimDto.cs
Normal file
3
Moonlight.Shared/Shared/Auth/ClaimDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Moonlight.Shared.Shared.Auth;
|
||||
|
||||
public record ClaimDto(string Type, string Value);
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Auth;
|
||||
namespace Moonlight.Shared.Shared.Auth;
|
||||
|
||||
public record SchemeDto(string Name, string DisplayName);
|
||||
@@ -1,14 +1,12 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Moonlight.Shared.Http.Requests;
|
||||
namespace Moonlight.Shared.Shared;
|
||||
|
||||
public class FilterOptions : IParsable<FilterOptions>
|
||||
{
|
||||
public Dictionary<string, string> Filters { get; set; }
|
||||
|
||||
public FilterOptions()
|
||||
{
|
||||
Filters = new();
|
||||
Filters = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
public FilterOptions(Dictionary<string, string> filters)
|
||||
@@ -16,6 +14,8 @@ public class FilterOptions : IParsable<FilterOptions>
|
||||
Filters = filters;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> Filters { get; set; }
|
||||
|
||||
public static FilterOptions Parse(string s, IFormatProvider? provider)
|
||||
{
|
||||
if (!TryParse(s, provider, out var result))
|
||||
@@ -30,7 +30,7 @@ public class FilterOptions : IParsable<FilterOptions>
|
||||
[MaybeNullWhen(false)] out FilterOptions result
|
||||
)
|
||||
{
|
||||
result = new();
|
||||
result = new FilterOptions();
|
||||
|
||||
if (string.IsNullOrEmpty(input))
|
||||
return true;
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses.Admin.Frontend;
|
||||
namespace Moonlight.Shared.Shared.Frontend;
|
||||
|
||||
public record FrontendConfigDto(string Name, string? ThemeCss);
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace Moonlight.Shared.Http.Responses;
|
||||
namespace Moonlight.Shared.Shared;
|
||||
|
||||
public record PagedData<T>(T[] Data, int TotalLength);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Moonlight.Shared.Http.Responses;
|
||||
namespace Moonlight.Shared.Shared;
|
||||
|
||||
public class ProblemDetails
|
||||
{
|
||||
Reference in New Issue
Block a user