mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Adds user settings management
Adds the UserSettings aggregate with pagination and alpha picker preferences, keyed to a user with a dedicated UserId foreign key. Adds GET and PUT /users/me/settings API endpoints, a localized Tools > Settings page with save confirmation, the EF migration for the UserSettings table, and unit, integration and security tests.
This commit is contained in:
1 parent
c3f8786fe4
commit
2354e21d42
65 files changed
+4711
-21
No files matched your search
+47
@@ -0,0 +1,47 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.Contracts.Responses.UsersManagement.Settings;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate.ValueObjects;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.UsersManagement.Users;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="UserSettingsEntity"/>.
|
||||
/// </summary>
|
||||
public static class UserSettingsEntityMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="UserSettings"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="Result{TValue}"/> containing either a successfully converted <see cref="UserSettings"/>, or an error message.
|
||||
/// </returns>
|
||||
public static Result<UserSettings> ToDomainEntity(this UserSettingsEntity repositoryEntity)
|
||||
{
|
||||
return UserSettings.Create(
|
||||
UserSettingsId.Create(repositoryEntity.Id),
|
||||
UserId.Create(repositoryEntity.UserId),
|
||||
repositoryEntity.IsPaginationEnabled,
|
||||
repositoryEntity.ItemsPerPage,
|
||||
repositoryEntity.IgnoreThePrefixForAlphaPicker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="repositoryEntity"/> to <see cref="UserSettingsResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="repositoryEntity">The repository entity to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static UserSettingsResponse ToResponse(this UserSettingsEntity repositoryEntity)
|
||||
{
|
||||
return new UserSettingsResponse(
|
||||
repositoryEntity.UserId,
|
||||
repositoryEntity.IsPaginationEnabled,
|
||||
repositoryEntity.ItemsPerPage,
|
||||
repositoryEntity.IgnoreThePrefixForAlphaPicker);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user