Implemented roles and action timestamps. Added oermissions selector and interfaces

This commit was merged in pull request #3.
This commit is contained in:
2026-01-14 19:03:17 +01:00
parent 43d43a6d7d
commit 06063b94b3
33 changed files with 1192 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Moonlight.Shared.Http.Requests.Roles;
public class CreateRoleRequest
{
[Required] [MaxLength(15)] public string Name { get; set; }
[MaxLength(100)] public string Description { get; set; } = "";
[Required] public string[] Permissions { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Moonlight.Shared.Http.Requests.Roles;
public class UpdateRoleRequest
{
[Required] [MaxLength(15)] public string Name { get; set; }
[MaxLength(100)] public string Description { get; set; } = "";
[Required] public string[] Permissions { get; set; }
}

View File

@@ -0,0 +1,3 @@
namespace Moonlight.Shared.Http.Responses.Admin;
public record RoleResponse(int Id, string Name, string Description, string[] Permissions, int MemberCount, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);

View File

@@ -1,3 +1,3 @@
namespace Moonlight.Shared.Http.Responses.Users;
public record UserResponse(int Id, string Username, string Email);
public record UserResponse(int Id, string Username, string Email, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);

View File

@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using Moonlight.Shared.Http.Requests.Roles;
using Moonlight.Shared.Http.Requests.Users;
using Moonlight.Shared.Http.Responses;
using Moonlight.Shared.Http.Responses.Admin;
@@ -15,6 +16,10 @@ namespace Moonlight.Shared.Http;
[JsonSerializable(typeof(UserResponse))]
[JsonSerializable(typeof(SystemInfoResponse))]
[JsonSerializable(typeof(PagedData<UserResponse>))]
[JsonSerializable(typeof(PagedData<RoleResponse>))]
[JsonSerializable(typeof(RoleResponse))]
[JsonSerializable(typeof(CreateRoleRequest))]
[JsonSerializable(typeof(UpdateRoleRequest))]
public partial class SerializationContext : JsonSerializerContext
{
}