mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 10:04:44 +00:00
- 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.
This commit is contained in:
27
web/backend/Domain/Domain.Entities/Entities/BeerPost.cs
Normal file
27
web/backend/Domain/Domain.Entities/Entities/BeerPost.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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; }
|
||||
}
|
||||
@@ -1,13 +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 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 City? City { get; set; }
|
||||
public byte[]? Coordinates { get; set; }
|
||||
public byte[]? Timer { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public City? City { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,38 +1,56 @@
|
||||
namespace Domain.Entities;
|
||||
|
||||
public class City
|
||||
public sealed class City
|
||||
{
|
||||
// PK
|
||||
public Guid CityId { get; set; }
|
||||
public string CityName { get; set; } = string.Empty;
|
||||
|
||||
// FK References
|
||||
public Guid StateProvinceId { get; set; }
|
||||
|
||||
public StateProvince? StateProvince { get; set; }
|
||||
// Attributes
|
||||
public string CityName { get; set; } = string.Empty;
|
||||
|
||||
public byte[]? Timer { get; set; }
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public StateProvince? StateProvince { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class StateProvince
|
||||
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;
|
||||
public Guid CountryId { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
|
||||
// Navigation Properties
|
||||
public Country? Country { get; set; }
|
||||
|
||||
public byte[]? Timer { get; set; }
|
||||
}
|
||||
|
||||
public class Country
|
||||
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.
|
||||
|
||||
public byte[]? Timer { get; set; }
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
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 byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,11 +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 bool IsRevoked { get; set; }
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
// Audit Fields
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,9 +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; }
|
||||
|
||||
// Audit Fields
|
||||
public byte[]? RowVersion { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user