Refactored project to module structure
This commit is contained in:
22
Moonlight.Api/Infrastructure/Database/Entities/ApiKey.cs
Normal file
22
Moonlight.Api/Infrastructure/Database/Entities/ApiKey.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Moonlight.Api.Infrastructure.Database.Interfaces;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.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; } = [];
|
||||
public DateTimeOffset ValidUntil { get; set; }
|
||||
|
||||
[MaxLength(32)] public string Key { get; set; }
|
||||
|
||||
// Action timestamps
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
22
Moonlight.Api/Infrastructure/Database/Entities/Role.cs
Normal file
22
Moonlight.Api/Infrastructure/Database/Entities/Role.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Moonlight.Api.Infrastructure.Database.Interfaces;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.Database.Entities;
|
||||
|
||||
public class Role : 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; } = [];
|
||||
|
||||
// Relations
|
||||
public List<RoleMember> Members { get; set; } = [];
|
||||
|
||||
// Action timestamps
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
15
Moonlight.Api/Infrastructure/Database/Entities/RoleMember.cs
Normal file
15
Moonlight.Api/Infrastructure/Database/Entities/RoleMember.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Moonlight.Api.Infrastructure.Database.Interfaces;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.Database.Entities;
|
||||
|
||||
public class RoleMember : IActionTimestamps
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public Role Role { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
// Action timestamps
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.Database.Entities;
|
||||
|
||||
public class SettingsOption
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[MaxLength(256)] public required string Key { get; set; }
|
||||
|
||||
[MaxLength(4096)]
|
||||
[Column(TypeName = "jsonb")]
|
||||
public required string ValueJson { get; set; }
|
||||
}
|
||||
18
Moonlight.Api/Infrastructure/Database/Entities/Theme.cs
Normal file
18
Moonlight.Api/Infrastructure/Database/Entities/Theme.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.Database.Entities;
|
||||
|
||||
public class Theme
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[MaxLength(30)] public required string Name { get; set; }
|
||||
|
||||
[MaxLength(30)] public required string Version { get; set; }
|
||||
|
||||
[MaxLength(30)] public required string Author { get; set; }
|
||||
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[MaxLength(20_000)] public required string CssContent { get; set; }
|
||||
}
|
||||
24
Moonlight.Api/Infrastructure/Database/Entities/User.cs
Normal file
24
Moonlight.Api/Infrastructure/Database/Entities/User.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Moonlight.Api.Infrastructure.Database.Interfaces;
|
||||
|
||||
namespace Moonlight.Api.Infrastructure.Database.Entities;
|
||||
|
||||
public class User : IActionTimestamps
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
// Base information
|
||||
[MaxLength(50)] public required string Username { get; set; }
|
||||
|
||||
[MaxLength(254)] public required string Email { get; set; }
|
||||
|
||||
// Authentication
|
||||
public DateTimeOffset InvalidateTimestamp { get; set; }
|
||||
|
||||
// Relations
|
||||
public List<RoleMember> RoleMemberships { get; set; } = [];
|
||||
|
||||
// Action timestamps
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user