Stores scheduler page display preferences per user

This commit is contained in:
BinaryAlley committed 2026-09-03 14:06:01 -07:00
1 parent ab8ab51397
commit 237be9e2c8
50 files changed
+3144 -60

No files matched your search

@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.Scheduling;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.Scheduling;
/// <summary>
/// Repository entity for the display preferences of the scheduler page of a user.
/// </summary>
[DebuggerDisplay("UserId: {UserId}, DisplayTimeSpan: {DisplayTimeSpan}")]
public class SchedulerDisplayPreferencesEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets or sets the Id of the display preferences.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets or sets the Id of the user that owns the display preferences.
/// </summary>
public required Guid UserId { get; set; }
/// <summary>
/// Gets or sets the type of the scheduled job tasks whose executions are shown on the scheduler page, or <see langword="null"/> when all of them are shown.
/// </summary>
public ScheduledTaskType? JobTypeFilter { get; set; }
/// <summary>
/// Gets or sets the time span, expressed in <see cref="DisplayTimeUnit"/>, that the scheduler page shows.
/// </summary>
public required int DisplayTimeSpan { get; set; }
/// <summary>
/// Gets or sets the unit in which the displayed time span of the scheduler page is expressed.
/// </summary>
public required SchedulerDisplayTimeUnit DisplayTimeUnit { 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,32 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Scheduling;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Domain.Common.Primitives;
using System;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Scheduling;
/// <summary>
/// Interface for the repository for the display preferences of the scheduler page.
/// </summary>
public interface ISchedulerDisplayPreferencesRepository : IRepository<SchedulerDisplayPreferencesEntity>
{
/// <summary>
/// Gets the display preferences of the scheduler page of the user identified by <paramref name="userId"/>, if they exist.
/// </summary>
/// <param name="userId">The Id of the user whose display preferences are retrieved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either the display preferences of the user, or an error.</returns>
Task<Result<SchedulerDisplayPreferencesEntity?>> GetByUserIdAsync(Guid userId, CancellationToken cancellationToken);
/// <summary>
/// Inserts the display preferences of the scheduler page of a user, or updates them when they already exist.
/// </summary>
/// <param name="preferences">The display preferences to insert or update.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
Task<Result<Updated>> UpsertAsync(SchedulerDisplayPreferencesEntity preferences, CancellationToken cancellationToken);
}
@@ -98,6 +98,11 @@ public interface IUnitOfWork
/// </summary>
IScheduledJobExecutionRepository ScheduledJobExecutionRepository { get; }
/// <summary>
/// Gets the scheduler display preferences repository.
/// </summary>
ISchedulerDisplayPreferencesRepository SchedulerDisplayPreferencesRepository { get; }
/// <summary>
/// Gets the plugin repository.
/// </summary>