mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 18:14:44 +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
52 lines
2.7 KiB
C#
52 lines
2.7 KiB
C#
using Domain.Entities;
|
|
|
|
namespace Features.Breweries.Repository;
|
|
|
|
/// <summary>
|
|
/// Repository for CRUD operations on brewery post records.
|
|
/// </summary>
|
|
public interface IBreweryRepository
|
|
{
|
|
/// <summary>
|
|
/// Retrieves a brewery post by ID, joined to its location. Returns <c>null</c> if no brewery post
|
|
/// exists with the given ID, or if it has no associated location.
|
|
/// </summary>
|
|
Task<BreweryPost?> GetByIdAsync(Guid id);
|
|
|
|
/// <summary>
|
|
/// Retrieves all brewery posts, optionally paginated, ordered by creation date descending. Posts
|
|
/// without a location are included, with <see cref="BreweryPost.Location" /> left <c>null</c>.
|
|
/// </summary>
|
|
/// <param name="limit">Maximum number of rows to return. Unbounded if <see langword="null" />.</param>
|
|
/// <param name="offset">Number of rows to skip. Treated as zero if <see langword="null" />.</param>
|
|
Task<IEnumerable<BreweryPost>> GetAllAsync(int? limit, int? offset);
|
|
|
|
/// <summary>
|
|
/// Updates a brewery post's name and description, and upserts or clears its location, enforcing
|
|
/// optimistic concurrency via <paramref name="brewery" />'s <c>RowVersion</c>: the update is rejected
|
|
/// if the row was modified since <c>RowVersion</c> was read. When <paramref name="brewery" />'s
|
|
/// <c>Location</c> is <c>null</c>, any existing location for the brewery is removed.
|
|
/// Returns the freshly persisted brewery, including its new <c>RowVersion</c>.
|
|
/// </summary>
|
|
/// <exception cref="Domain.Exceptions.NotFoundException">
|
|
/// Thrown when no brewery exists with the given ID, or the given location's <c>CityId</c> does not
|
|
/// exist.
|
|
/// </exception>
|
|
/// <exception cref="Domain.Exceptions.ConflictException">
|
|
/// Thrown when <paramref name="brewery" />'s <c>RowVersion</c> no longer matches the stored row (it was
|
|
/// modified by another request since it was last read).
|
|
/// </exception>
|
|
Task<BreweryPost> UpdateAsync(BreweryPost brewery);
|
|
|
|
/// <summary>Deletes a brewery post by ID. Its location and photos are removed via cascading foreign keys.</summary>
|
|
/// <exception cref="Domain.Exceptions.NotFoundException">Thrown when no brewery exists with the given <paramref name="id" />.</exception>
|
|
Task DeleteAsync(Guid id);
|
|
|
|
/// <summary>Creates a new brewery post, including its location details.</summary>
|
|
/// <exception cref="ArgumentException">Thrown when <paramref name="brewery" /> has no <c>Location</c>.</exception>
|
|
/// <exception cref="Domain.Exceptions.NotFoundException">
|
|
/// Thrown when <paramref name="brewery" />'s <c>PostedById</c> or <c>Location.CityId</c> does not exist.
|
|
/// </exception>
|
|
Task CreateAsync(BreweryPost brewery);
|
|
}
|