mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
* Integrate Spectre.Console into seed application, use async data loading * Replace stored-procedure repositories with Dapper-based repositories Removes the USP_* stored procedures for Auth, Location, and Brewery data access in favour of services built with Dapper. Adds a new Features.Locations slice and optimistic concurrency support for the Brewery slice. * Add new documentation for Dapper migration/database schema * Update FluentAssertions to most recent open source ver * Update XML doc comment in backend projects * Modify brewery location dto to include denormalized data * - Updated column names from 'Timer' to 'RowVersion' in schema.sql for - Introduced new BeerPost entity and updated BreweryPost and BreweryPostLocation entities to use 'RowVersion' for concurrency. - Modified UserAccount, UserCredential, UserVerification, City, StateProvince, and Country entities to use 'RowVersion' instead of 'Timer'. - Updated tests and command handlers to reflect changes in concurrency token from 'Timer' to 'RowVersion'. - Adjusted BreweryDto and BreweryDtoMapper to include 'RowVersion' and updated mapping logic accordingly. - Ensured all repository methods and interfaces are aligned with the new concurrency handling approach. * updates * Add BeerStyle entity and related properties; refactor BreweryDto to remove BeerPosts * Fix Api.Specs test failures: stale Timer column refs and missing test.user fixture * Remove repository tests, usages of registration dto used in repo * archive old stored procs/functions * update stale docs * Add instructions for generating cryptographically secure base64 secrets on macOS/Linux and Windows
40 lines
2.0 KiB
C#
40 lines
2.0 KiB
C#
using Domain.Entities;
|
|
using Features.Auth.Dtos;
|
|
|
|
namespace Features.Auth.Repository;
|
|
|
|
/// <summary>
|
|
/// Repository for authentication-related database operations including user registration and credential management.
|
|
/// </summary>
|
|
public interface IAuthRepository
|
|
{
|
|
/// <summary>
|
|
/// Registers a new user account and its initial credential as a single atomic operation, then
|
|
/// returns the created account.
|
|
/// </summary>
|
|
/// <exception cref="Exception">Thrown when the newly registered user cannot be retrieved after registration.</exception>
|
|
Task<UserAccount> RegisterUserAsync(UserAccount ua);
|
|
|
|
/// <summary>Retrieves a user account by email, or <see langword="null" /> if none exists.</summary>
|
|
Task<UserAccount?> GetUserByEmailAsync(string email);
|
|
|
|
/// <summary>Retrieves a user account by username, or <see langword="null" /> if none exists.</summary>
|
|
Task<UserAccount?> GetUserByUsernameAsync(string username);
|
|
|
|
/// <summary>Retrieves the active (non-revoked) credential for a user account, or <see langword="null" /> if none exists.</summary>
|
|
Task<UserCredential?> GetActiveCredentialByUserAccountIdAsync(Guid userAccountId);
|
|
|
|
/// <summary>Rotates a user's credential by invalidating all existing credentials and creating a new one.</summary>
|
|
/// <exception cref="Domain.Exceptions.NotFoundException">Thrown when no account with <paramref name="userAccountId" /> exists.</exception>
|
|
Task RotateCredentialAsync(Guid userAccountId, string newPasswordHash);
|
|
|
|
/// <summary>Marks a user account as confirmed. Idempotent if the account is already verified.</summary>
|
|
Task<UserAccount?> ConfirmUserAccountAsync(Guid userAccountId);
|
|
|
|
/// <summary>Retrieves a user account by ID, or <see langword="null" /> if none exists.</summary>
|
|
Task<UserAccount?> GetUserByIdAsync(Guid userAccountId);
|
|
|
|
/// <summary>Determines whether a user account has been verified.</summary>
|
|
Task<bool> IsUserVerifiedAsync(Guid userAccountId);
|
|
}
|