Introduced `UserPreferencesDto` to represent UI preferences, including theme, dark mode, and grid layouts. Added the `IUserPreferencesService` interface and implemented it in `UserPreferencesService` to manage preferences stored in the distributed cache (`dbo.TBDD_CACHE`). Registered `UserPreferencesService` in dependency injection and added a NuGet reference for `Microsoft.Extensions.Caching.Abstractions`. Created `UserPreferencesController` with `GET` and `PUT` endpoints to retrieve and save user preferences. Validated theme names in the `PUT` endpoint. Updated `Program.cs` to ensure proper service registration.
27 lines
917 B
C#
27 lines
917 B
C#
namespace EnvelopeGenerator.Application.Common.Dto;
|
|
|
|
/// <summary>
|
|
/// Represents a user's UI preferences stored in the distributed cache (dbo.TBDD_CACHE).
|
|
/// </summary>
|
|
public sealed class UserPreferencesDto
|
|
{
|
|
/// <summary>
|
|
/// The active DevExpress theme name.
|
|
/// Allowed values: "blazing-berry", "fluent", "purple"
|
|
/// </summary>
|
|
public string ThemeName { get; set; } = "blazing-berry";
|
|
|
|
/// <summary>
|
|
/// Whether dark mode is active.
|
|
/// Default: false (light mode).
|
|
/// </summary>
|
|
public bool IsDarkMode { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Persisted DxGrid layout states, keyed by a stable grid identifier.
|
|
/// Example keys: "sender.active-envelopes", "sender.completed-envelopes"
|
|
/// Values are opaque JSON strings produced by DxGrid.SaveLayoutAsync().
|
|
/// </summary>
|
|
public Dictionary<string, string> GridLayouts { get; set; } = new();
|
|
}
|