mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Migrate Auth/Brewery/Location repositories to pure Dapper; rename Timer to RowVersion (#237)
* 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
This commit is contained in:
29
web/backend/Domain/Domain.Entities/Entities/BeerPost.cs
Normal file
29
web/backend/Domain/Domain.Entities/Entities/BeerPost.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public sealed class BeerPost
|
||||
{
|
||||
// PK
|
||||
public Guid BeerPostId { get; set; } = Guid.Empty;
|
||||
|
||||
// FK References
|
||||
public Guid PostedById { get; set; } = Guid.Empty;
|
||||
public Guid BeerStyleId { get; set; } = Guid.Empty;
|
||||
public Guid BrewedById { get; set; } = Guid.Empty;
|
||||
|
||||
// Attributes
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public decimal ABV { get; set; }
|
||||
public int IBU { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public UserAccount? PostedBy { get; set; }
|
||||
public BreweryPost? BrewedBy { get; set; }
|
||||
|
||||
public BeerStyle? BeerStyle { get; set; }
|
||||
}
|
||||
16
web/backend/Domain/Domain.Entities/Entities/BeerStyle.cs
Normal file
16
web/backend/Domain/Domain.Entities/Entities/BeerStyle.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public sealed class BeerStyle
|
||||
{
|
||||
// PK
|
||||
public Guid BeerStyleId { get; set; } = Guid.Empty;
|
||||
|
||||
// Attributes
|
||||
public string BeerStyleName { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class BreweryPost
|
||||
public sealed class BreweryPost
|
||||
{
|
||||
// PK
|
||||
public Guid BreweryPostId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid PostedById { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string BreweryName { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
public UserAccount PostedBy { get; set; } = null!;
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public BreweryPostLocation? Location { get; set; }
|
||||
public List<BeerPost> BeerPosts { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class BreweryPostLocation
|
||||
public sealed class BreweryPostLocation
|
||||
{
|
||||
// PK
|
||||
public Guid BreweryPostLocationId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid BreweryPostId { get; set; }
|
||||
public Guid CityId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string AddressLine1 { get; set; } = string.Empty;
|
||||
public string? AddressLine2 { get; set; }
|
||||
public string PostalCode { get; set; } = string.Empty;
|
||||
public Guid CityId { get; set; }
|
||||
public byte[]? Coordinates { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
public BreweryPost BreweryPost { get; set; } = null!;
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public City? City { get; set; }
|
||||
}
|
||||
|
||||
19
web/backend/Domain/Domain.Entities/Entities/City.cs
Normal file
19
web/backend/Domain/Domain.Entities/Entities/City.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public sealed class City
|
||||
{
|
||||
// PK
|
||||
public Guid CityId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid StateProvinceId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string CityName { get; set; } = string.Empty;
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public StateProvince? StateProvince { get; set; }
|
||||
}
|
||||
15
web/backend/Domain/Domain.Entities/Entities/Country.cs
Normal file
15
web/backend/Domain/Domain.Entities/Entities/Country.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public sealed class Country
|
||||
{
|
||||
// PK
|
||||
public Guid CountryId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string CountryName { get; set; } = string.Empty;
|
||||
|
||||
public string ISO3166_1 { get; set; } = string.Empty; // this is the iso 3166-1 alpha-2 code for the country, e.g. "US" for United States, "CA" for Canada, etc.
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
23
web/backend/Domain/Domain.Entities/Entities/StateProvince.cs
Normal file
23
web/backend/Domain/Domain.Entities/Entities/StateProvince.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public sealed class StateProvince
|
||||
{
|
||||
// PK
|
||||
public Guid StateProvinceId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid CountryId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string StateProvinceName { get; set; } = string.Empty;
|
||||
|
||||
// this is the iso 3166-2 code for the state/province, e.g. "CA" for California, "ON" for Ontario, etc.
|
||||
// and is rendered like US-CA for California, CA-ON for Ontario, etc.
|
||||
public string ISO3166_2 { get; set; } = string.Empty;
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public Country? Country { get; set; }
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserAccount
|
||||
public sealed class UserAccount
|
||||
{
|
||||
// PK
|
||||
public Guid UserAccountId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
public ICollection<BreweryPost> BreweryPosts { get; set; } = [];
|
||||
public ICollection<UserCredential> UserCredentials { get; set; } = [];
|
||||
public UserVerification? Verification { get; set; }
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation properties
|
||||
public UserCredential? UserCredential { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserCredential
|
||||
public sealed class UserCredential
|
||||
{
|
||||
// PK
|
||||
public Guid UserCredentialId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid UserAccountId { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
// Attributes
|
||||
public DateTime Expiry { get; set; }
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public byte[]? Timer { get; set; }
|
||||
public UserAccount UserAccount { get; set; } = null!;
|
||||
public bool IsRevoked { get; set; }
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class UserVerification
|
||||
public sealed class UserVerification
|
||||
{
|
||||
// PK
|
||||
public Guid UserVerificationId { get; set; }
|
||||
|
||||
// FK References
|
||||
public Guid UserAccountId { get; set; }
|
||||
|
||||
// Attributes
|
||||
public DateTime VerificationDateTime { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
public UserAccount UserAccount { get; set; } = null!;
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user