Interface IEmailVerificationCodeRepository
- Namespace
- Builvero.Application.Interfaces.Repositories
- Assembly
- Builvero.Application.dll
Defines the contract for email verification code data access operations including retrieval, creation, and usage tracking.
public interface IEmailVerificationCodeRepository
Remarks
This repository interface provides methods for managing email verification code entities. Verification codes are used to verify user email addresses and have expiration times. Once used, codes are marked as used to prevent reuse.
Methods
CreateAsync(EmailVerificationCode, CancellationToken)
Creates a new email verification code entity in the database.
Task<EmailVerificationCode> CreateAsync(EmailVerificationCode code, CancellationToken cancellationToken = default)
Parameters
codeEmailVerificationCodeThe email verification code entity to create.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<EmailVerificationCode>
The created email verification code entity with generated ID and timestamps.
GetByEmailAndCodeAsync(string, string, CancellationToken)
Retrieves an email verification code by email address and code value.
Task<EmailVerificationCode?> GetByEmailAndCodeAsync(string email, string code, CancellationToken cancellationToken = default)
Parameters
emailstringThe email address associated with the verification code.
codestringThe verification code value.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<EmailVerificationCode>
The email verification code entity if found and not expired/used; otherwise, null.
MarkAsUsedAsync(Guid, CancellationToken)
Marks an email verification code as used, preventing its reuse.
Task MarkAsUsedAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the verification code to mark as used.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task
A task representing the asynchronous operation.