-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIOAuthAuthCodeRepository.cs
More file actions
24 lines (20 loc) · 1.02 KB
/
IOAuthAuthCodeRepository.cs
File metadata and controls
24 lines (20 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Taskdeck.Domain.Entities;
namespace Taskdeck.Application.Interfaces;
public interface IOAuthAuthCodeRepository : IRepository<OAuthAuthCode>
{
/// <summary>
/// Finds an auth code by its code string. Returns null if not found.
/// </summary>
Task<OAuthAuthCode?> GetByCodeAsync(string code, CancellationToken cancellationToken = default);
/// <summary>
/// Atomically consumes an auth code by setting IsConsumed = true where IsConsumed = false.
/// Returns true if the code was consumed (affected 1 row), false if already consumed or not found.
/// This provides single-use semantics safe for concurrent requests.
/// </summary>
Task<bool> TryConsumeAtomicAsync(string code, CancellationToken cancellationToken = default);
/// <summary>
/// Deletes all auth codes that have expired before the specified cutoff time.
/// Returns the number of codes removed.
/// </summary>
Task<int> DeleteExpiredAsync(DateTimeOffset cutoff, CancellationToken cancellationToken = default);
}