Table of Contents

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

code EmailVerificationCode

The email verification code entity to create.

cancellationToken CancellationToken

Cancellation 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

email string

The email address associated with the verification code.

code string

The verification code value.

cancellationToken CancellationToken

Cancellation 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

id Guid

The unique identifier of the verification code to mark as used.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.