Fixed error of mapping with proofs
This commit is contained in:
@@ -7,7 +7,7 @@ using FastEndpoints;
|
||||
|
||||
namespace BeReadyBackend.Endpoints.Users;
|
||||
|
||||
public class GetAllUserProofsEndpoint(UsersRepository usersRepository, UserService userService, AutoMapper.IMapper mapper) : EndpointWithoutRequest<List<GetUserProofDto>>
|
||||
public class GetAllUserProofsEndpoint(UsersRepository usersRepository, UserService userService) : EndpointWithoutRequest<List<GetUserProofDto>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
@@ -31,12 +31,18 @@ public class GetAllUserProofsEndpoint(UsersRepository usersRepository, UserServi
|
||||
proofs.AddRange(
|
||||
user.UserRandomChallenges
|
||||
.Where(x => x.Proof is not null)
|
||||
.Select(x => mapper.Map<GetUserProofDto>(x.RandomChallenge))
|
||||
.Select(x => new GetUserProofDto
|
||||
{
|
||||
Proof = x.Proof
|
||||
})
|
||||
);
|
||||
|
||||
if (user.UserGroups is not null)
|
||||
proofs.AddRange(
|
||||
user.UserGroups.Select(x => mapper.Map<GetUserProofDto>(x.Group))
|
||||
user.UserGroups.Select(x => new GetUserProofDto
|
||||
{
|
||||
Proof = x.Proof
|
||||
})
|
||||
);
|
||||
|
||||
await Send.OkAsync(proofs, ct);
|
||||
|
||||
Reference in New Issue
Block a user