32 lines
1 KiB
C#
32 lines
1 KiB
C#
using Dapper;
|
|
using Galaeth.Core.Entities;
|
|
using Galaeth.Core.Infrastructure;
|
|
using Galaeth.Core.RepositoryInterfaces;
|
|
using Injectio.Attributes;
|
|
|
|
namespace Galaeth.DAL.Repositories;
|
|
|
|
/// <inheritdoc cref="Galaeth.Core.RepositoryInterfaces.IRefreshTokenRepository" />
|
|
[RegisterScoped]
|
|
public class RefreshTokenRepository : BaseRepository<RefreshToken, string>, IRefreshTokenRepository
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RefreshTokenRepository"/> class.
|
|
/// </summary>
|
|
/// <param name="db">Instance of <see cref="IDbConnectionProvider"/>.</param>
|
|
public RefreshTokenRepository(IDbConnectionProvider db)
|
|
: base(db)
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc cref="Galaeth.Core.RepositoryInterfaces.IRefreshTokenRepository" />
|
|
public async Task RevokeAllForUser(Guid userId)
|
|
{
|
|
await WithDatabaseAsync(async connection => await connection.ExecuteAsync(
|
|
$"DELETE FROM {Table} WHERE userId = @pUserId", new
|
|
{
|
|
pUserId = userId,
|
|
}));
|
|
}
|
|
}
|