mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Adds the server-side theme repository and reworks the web theme engine onto it
This commit is contained in:
1 parent
85928f7c3c
commit
bf8faba24d
136 files changed
+6942
-1197
No files matched your search
@@ -0,0 +1,90 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Themes;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DataAccess.Entities.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Repository entity for a theme.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("ThemeId: {ThemeId}, Name: {Name}")]
|
||||
public class ThemeEntity : IStorageEntity, IAuditableEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the theme.
|
||||
/// </summary>
|
||||
public required Guid Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the theme, taken from its manifest and used by clients to reference it.
|
||||
/// </summary>
|
||||
public required string ThemeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name of the theme.
|
||||
/// </summary>
|
||||
public required string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description of the theme.
|
||||
/// </summary>
|
||||
public required string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the author of the theme.
|
||||
/// </summary>
|
||||
public required string Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the version of the theme, using semantic version form.
|
||||
/// </summary>
|
||||
public required string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path of the theme preview image, relative to the theme pack root, or <see langword="null"/> when the theme has no preview.
|
||||
/// </summary>
|
||||
public string? PreviewPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the source the theme was installed from.
|
||||
/// </summary>
|
||||
public required ThemeInstallSource InstallSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this is the currently active theme. At most one theme can be current.
|
||||
/// </summary>
|
||||
public bool? IsCurrent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the theme was soft deleted, so it is not shown and not reinstalled automatically.
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC timestamp at which the theme was installed.
|
||||
/// </summary>
|
||||
public required DateTime InstalledAtUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
public required DateTime CreatedOnUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Id of the user that created the entity.
|
||||
/// </summary>
|
||||
public required Guid CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional time and date when the entity was updated.
|
||||
/// </summary>
|
||||
public DateTime? UpdatedOnUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the optional Id of the user that updated the entity.
|
||||
/// </summary>
|
||||
public required Guid? UpdatedBy { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Themes;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DataAccess.Repositories.Themes;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for the repository for themes.
|
||||
/// </summary>
|
||||
public interface IThemeRepository : IRepository<ThemeEntity>,
|
||||
IGetAllRepositoryAction<ThemeEntity>,
|
||||
IInsertRepositoryAction<ThemeEntity>,
|
||||
IUpdateRepositoryAction<ThemeEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a theme identified by its manifest <paramref name="themeId"/> from the storage medium.
|
||||
/// </summary>
|
||||
/// <param name="themeId">The manifest id of the theme to get.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a <see cref="ThemeEntity"/> identified by <paramref name="themeId"/>, or an error.</returns>
|
||||
Task<Result<ThemeEntity?>> GetByThemeIdAsync(string themeId, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently active theme from the storage medium.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either the active <see cref="ThemeEntity"/>, or an error.</returns>
|
||||
Task<Result<ThemeEntity?>> GetCurrentAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Lumina.Application.Common.DataAccess.Repositories.Authorization;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Plugins;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Themes;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Users;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -75,6 +76,11 @@ public interface IUnitOfWork
|
||||
/// </summary>
|
||||
IPluginRepository PluginRepository { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the theme repository.
|
||||
/// </summary>
|
||||
IThemeRepository ThemeRepository { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user repository.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user