mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-01 11:23:36 +02:00
Use ExecuteDelete for removing API keys
This commit is contained in:
parent
c9c133bc43
commit
ad58d1f77c
|
@ -58,19 +58,10 @@ namespace Jellyfin.Server.Implementations.Security
|
||||||
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (dbContext.ConfigureAwait(false))
|
await using (dbContext.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
var key = await dbContext.ApiKeys
|
await dbContext.ApiKeys
|
||||||
.Where(apiKey => apiKey.AccessToken == accessToken)
|
.Where(apiKey => apiKey.AccessToken == accessToken)
|
||||||
.FirstOrDefaultAsync()
|
.ExecuteDeleteAsync()
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (key is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbContext.Remove(key);
|
|
||||||
|
|
||||||
await dbContext.SaveChangesAsync().ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue