Include UserRoles and Role in GetJwtTokenQueryHandler for enhanced user data retrieval

This commit is contained in:
masoodafar-web
2025-11-14 03:24:16 +03:30
parent c01dda5846
commit a0270b00de

View File

@@ -13,6 +13,8 @@ public class GetJwtTokenQueryHandler : IRequestHandler<GetJwtTokenQuery, GetJwtT
public async Task<GetJwtTokenResponseDto> Handle(GetJwtTokenQuery request, CancellationToken cancellationToken)
{
var user = await _context.Users
.Include(u => u.UserRoles)
.ThenInclude(ur => ur.Role)
.FirstOrDefaultAsync(x => x.Id == request.Id, cancellationToken) ?? throw new NotFoundException(nameof(User), request.Id);
return new GetJwtTokenResponseDto()
{