Skip to content

Commit

Permalink
fix broken grant delete
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jan 24, 2024
1 parent 74f8cd5 commit 1d453ca
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ public async Task DeleteByKeyAsync(string key)
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = from g in dbContext.Grants
where g.Key == key
select g;
dbContext.Remove(query);
await dbContext.SaveChangesAsync();
await dbContext.Grants.Where(g => g.Key == key).ExecuteDeleteAsync();
}
}

Expand All @@ -32,14 +28,11 @@ public async Task DeleteManyAsync(string subjectId, string sessionId, string cli
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var query = from g in dbContext.Grants
where g.SubjectId == subjectId &&
g.ClientId == clientId &&
g.SessionId == sessionId &&
g.Type == type
select g;
dbContext.Remove(query);
await dbContext.SaveChangesAsync();
await dbContext.Grants.Where(g =>
g.SubjectId == subjectId &&
g.ClientId == clientId &&
g.SessionId == sessionId &&
g.Type == type).ExecuteDeleteAsync();

Check warning on line 35 in src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs

View check run for this annotation

Codecov / codecov/patch

src/Infrastructure.EntityFramework/Auth/Repositories/GrantRepository.cs#L31-L35

Added lines #L31 - L35 were not covered by tests
}
}

Expand Down

0 comments on commit 1d453ca

Please sign in to comment.