Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrderBy operator on query #12

Open
gkama opened this issue Dec 4, 2020 · 0 comments
Open

OrderBy operator on query #12

gkama opened this issue Dec 4, 2020 · 0 comments
Assignees
Labels
aiof auth aiof-auth microservice specific enhancement New feature or request

Comments

@gkama
Copy link
Member

gkama commented Dec 4, 2020

There is a missing OrderBy that makes Entity Framework throw a warning log message when generating a JWT for a user.

image

This warning is appearing even though the following query is setup via LINQ:

public async Task<IUserRefreshToken> GetRefreshTokenAsync(int userId)
{
    return await GetRefreshTokensQuery()
        .Where(x => x.UserId == userId
            && x.Revoked == null)
        .OrderByDescending(x => x.Expires)
        .Take(1)
        .FirstOrDefaultAsync();
}

In this specific example, it essentially checks if there are any existing refresh tokens. If not (the call from this function is null), then create one. Else, return the token

@gkama gkama self-assigned this Dec 4, 2020
@gkama gkama added the enhancement New feature or request label Dec 4, 2020
@gkama gkama added the aiof auth aiof-auth microservice specific label Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aiof auth aiof-auth microservice specific enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant