Implemented API key management with permission checks, database schema, and frontend integration. Adjusted string lengths for Role and API key attributes.

This commit is contained in:
2026-01-16 15:06:45 +01:00
parent a28b8aca7a
commit 01c86406dc
23 changed files with 1223 additions and 11 deletions

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using Moonlight.Api.Database.Interfaces;
namespace Moonlight.Api.Database.Entities;
public class ApiKey : IActionTimestamps
{
public int Id { get; set; }
[MaxLength(30)]
public required string Name { get; set; }
[MaxLength(300)]
public required string Description { get; set; }
public string[] Permissions { get; set; } = [];
[MaxLength(32)]
public string Key { get; set; }
// Action timestamps
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}

View File

@@ -7,10 +7,10 @@ public class Role : IActionTimestamps
{
public int Id { get; set; }
[MaxLength(15)]
[MaxLength(30)]
public required string Name { get; set; }
[MaxLength(100)]
[MaxLength(300)]
public required string Description { get; set; }
public string[] Permissions { get; set; } = [];