1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 11:03:37 +00:00

clear token by id

This commit is contained in:
Kyle Spearrin
2017-06-02 16:52:54 -04:00
parent bee1ac659b
commit 7b1c0d6df1
9 changed files with 54 additions and 23 deletions

View File

@@ -30,6 +30,22 @@ namespace Bit.Core.Repositories.SqlServer
return device;
}
public async Task<Device> GetByIdentifierAsync(string identifier)
{
using(var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Device>(
$"[{Schema}].[{Table}_ReadByIdentifier]",
new
{
Identifier = identifier
},
commandType: CommandType.StoredProcedure);
return results.FirstOrDefault();
}
}
public async Task<Device> GetByIdentifierAsync(string identifier, Guid userId)
{
using(var connection = new SqlConnection(ConnectionString))
@@ -60,13 +76,13 @@ namespace Bit.Core.Repositories.SqlServer
}
}
public async Task ClearPushTokenByIdentifierAsync(string identifier)
public async Task ClearPushTokenAsync(Guid id)
{
using(var connection = new SqlConnection(ConnectionString))
{
await connection.ExecuteAsync(
$"[{Schema}].[{Table}_ClearPushTokenByIdentifier]",
new { Identifier = identifier },
$"[{Schema}].[{Table}_ClearPushTokenById]",
new { Id = id },
commandType: CommandType.StoredProcedure);
}
}