Skip to content

Commit

Permalink
fix mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Jan 2, 2024
1 parent 975474b commit 8a43ee2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public async Task<ActionResult<AuthenticationResponseDto>> AuthenticateAsync(
};

var authenticationStatus = await this._userAuthenticationService.ValidateCredentialsAsync(authenticationRequest, cancellationToken);
this._logger.LogInformation($"{nameof(AuthenticateAsync)} - EmailAddress:{request.EmailAddress} AuthenticationStatus:{authenticationStatus}");
this._logger.LogInformation($"{nameof(AuthenticateAsync)} - EmailAddress:{request.EmailAddress}, AuthenticationStatus:{authenticationStatus}");

switch (authenticationStatus)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<Nullable>enable</Nullable>

<Version>1.1.0</Version>
<Version>1.1.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public Task<UserEntity[]> QueryAsync(
{
qurey = qurey.Where(predicate);
}
var items = qurey.Take(take).Skip(skip).ToArray();

var items = qurey.OrderBy(o => o.Id).Take(take).Skip(skip).ToArray();
return Task.FromResult(items);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Nager.Authentication/Nager.Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Nullable>enable</Nullable>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>

<Version>1.1.0</Version>
<Version>1.1.1</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
Expand Down
25 changes: 9 additions & 16 deletions src/Nager.Authentication/Services/UserManagementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ public UserManagementService(
this._userRepository = userRepository;
}

public async Task<UserInfo[]> QueryAsync(
int take,
int skip,
CancellationToken cancellationToken = default)
{
var items = await this._userRepository.QueryAsync(take, skip, cancellationToken: cancellationToken);
return items.OrderBy(user => user.EmailAddress).Select(userEntity => new UserInfo
{
Id = userEntity.Id,
EmailAddress = userEntity.EmailAddress,
Firstname = userEntity.Firstname,
Lastname = userEntity.Lastname,
Roles = RoleHelper.GetRoles(userEntity.RolesData)
}).ToArray();
}

private UserInfo MapUserInfo(UserEntity userEntity)
{
return new UserInfo
Expand All @@ -54,6 +38,15 @@ private UserInfo MapUserInfo(UserEntity userEntity)
};
}

public async Task<UserInfo[]> QueryAsync(
int take,
int skip,
CancellationToken cancellationToken = default)
{
var items = await this._userRepository.QueryAsync(take, skip, cancellationToken: cancellationToken);
return items.OrderBy(user => user.EmailAddress).Select(this.MapUserInfo).ToArray();
}

public async Task<UserInfo?> GetByIdAsync(
string id,
CancellationToken cancellationToken = default)
Expand Down

0 comments on commit 8a43ee2

Please sign in to comment.