#region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.DataAccess.Entities.UsersManagement; using Lumina.Contracts.Responses.UsersManagement.Settings; using Lumina.Domain.Common.Primitives; 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; /// /// Extension methods for converting . /// public static class UserSettingsEntityMapping { /// /// Converts to . /// /// The repository entity to be converted. /// /// An containing either a successfully converted , or an error message. /// public static Result ToDomainEntity(this UserSettingsEntity repositoryEntity) { return UserSettings.Create( UserSettingsId.Create(repositoryEntity.Id), UserId.Create(repositoryEntity.UserId), repositoryEntity.IsPaginationEnabled, repositoryEntity.ItemsPerPage, repositoryEntity.ShouldIgnoreThePrefixForAlphaPicker, repositoryEntity.IsThemeCachingEnabled, repositoryEntity.ShouldAggregateMetadataWhenMissing ); } /// /// Converts to . /// /// The repository entity to be converted. /// The converted response. public static UserSettingsResponse ToResponse(this UserSettingsEntity repositoryEntity) { return new UserSettingsResponse( repositoryEntity.UserId, repositoryEntity.IsPaginationEnabled, repositoryEntity.ItemsPerPage, repositoryEntity.ShouldIgnoreThePrefixForAlphaPicker, repositoryEntity.IsThemeCachingEnabled, repositoryEntity.ShouldAggregateMetadataWhenMissing ); } }