Fixed error of mapping with proofs

This commit is contained in:
2026-04-16 15:55:13 +01:00
parent c054b9d88c
commit d048d78cb2
3 changed files with 10 additions and 11 deletions
@@ -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);