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
208 lines
5.3 KiB
Plaintext
208 lines
5.3 KiB
Plaintext
@startuml database-schema
|
|
!theme plain
|
|
skinparam backgroundColor #FFFFFF
|
|
skinparam defaultFontName Arial
|
|
skinparam linetype ortho
|
|
skinparam packageStyle rectangle
|
|
|
|
title Database Schema
|
|
caption Every table also has a RowVersion ROWVERSION column (optimistic concurrency), omitted below for brevity.\nTables marked (*) have no repository/feature slice yet.
|
|
|
|
package "User & Auth" {
|
|
entity "UserAccount" as User {
|
|
* UserAccountID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* Username: VARCHAR(64) <<UNIQUE>>
|
|
* FirstName: NVARCHAR(128)
|
|
* LastName: NVARCHAR(128)
|
|
* Email: VARCHAR(128) <<UNIQUE>>
|
|
* CreatedAt: DATETIME
|
|
UpdatedAt: DATETIME
|
|
* DateOfBirth: DATE
|
|
}
|
|
|
|
entity "UserCredential" as Cred {
|
|
* UserCredentialID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* UserAccountID: UNIQUEIDENTIFIER <<FK>>
|
|
* CreatedAt: DATETIME
|
|
* Expiry: DATETIME
|
|
* Hash: NVARCHAR(256)
|
|
* IsRevoked: BIT
|
|
RevokedAt: DATETIME
|
|
}
|
|
|
|
entity "UserVerification" as Verify {
|
|
* UserVerificationID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* UserAccountID: UNIQUEIDENTIFIER <<FK, UNIQUE>>
|
|
* VerificationDateTime: DATETIME
|
|
}
|
|
|
|
entity "UserAvatar (*)" as Avatar {
|
|
* UserAvatarID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* UserAccountID: UNIQUEIDENTIFIER <<FK, UNIQUE>>
|
|
* PhotoID: UNIQUEIDENTIFIER <<FK>>
|
|
}
|
|
|
|
entity "UserFollow (*)" as Follow {
|
|
* UserFollowID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* UserAccountID: UNIQUEIDENTIFIER <<FK>>
|
|
* FollowingID: UNIQUEIDENTIFIER <<FK>>
|
|
* CreatedAt: DATETIME
|
|
}
|
|
|
|
entity "Photo (*)" as Photo {
|
|
* PhotoID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
Hyperlink: NVARCHAR(256)
|
|
* UploadedByID: UNIQUEIDENTIFIER <<FK>>
|
|
* UploadedAt: DATETIME
|
|
}
|
|
}
|
|
|
|
package "Location" {
|
|
entity "Country" as Country {
|
|
* CountryID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* CountryName: NVARCHAR(100)
|
|
* ISO3166_1: CHAR(2) <<UNIQUE>>
|
|
}
|
|
|
|
entity "StateProvince" as StateProvince {
|
|
* StateProvinceID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* StateProvinceName: NVARCHAR(100)
|
|
* ISO3166_2: CHAR(6) <<UNIQUE>>
|
|
* CountryID: UNIQUEIDENTIFIER <<FK>>
|
|
}
|
|
|
|
entity "City" as City {
|
|
* CityID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* CityName: NVARCHAR(100)
|
|
* StateProvinceID: UNIQUEIDENTIFIER <<FK>>
|
|
}
|
|
}
|
|
|
|
package "Brewery" {
|
|
entity "BreweryPost" as Brewery {
|
|
* BreweryPostID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* BreweryName: NVARCHAR(256)
|
|
* PostedByID: UNIQUEIDENTIFIER <<FK>>
|
|
* Description: NVARCHAR(512)
|
|
* CreatedAt: DATETIME
|
|
UpdatedAt: DATETIME
|
|
}
|
|
|
|
entity "BreweryPostLocation" as BreweryLoc {
|
|
* BreweryPostLocationID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* BreweryPostID: UNIQUEIDENTIFIER <<FK, UNIQUE>>
|
|
* AddressLine1: NVARCHAR(256)
|
|
AddressLine2: NVARCHAR(256)
|
|
* PostalCode: NVARCHAR(20)
|
|
* CityID: UNIQUEIDENTIFIER <<FK>>
|
|
Coordinates: GEOGRAPHY
|
|
}
|
|
|
|
entity "BreweryPostPhoto (*)" as BreweryPhoto {
|
|
* BreweryPostPhotoID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* BreweryPostID: UNIQUEIDENTIFIER <<FK>>
|
|
* PhotoID: UNIQUEIDENTIFIER <<FK>>
|
|
* LinkedAt: DATETIME
|
|
}
|
|
}
|
|
|
|
package "Beer (*)" {
|
|
entity "BeerStyle (*)" as BeerStyle {
|
|
* BeerStyleID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* StyleName: NVARCHAR(100) <<UNIQUE>>
|
|
Description: NVARCHAR(MAX)
|
|
}
|
|
|
|
entity "BeerPost (*)" as Beer {
|
|
* BeerPostID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* Name: NVARCHAR(100)
|
|
* Description: NVARCHAR(MAX)
|
|
* ABV: DECIMAL(4,2)
|
|
* IBU: INT
|
|
* PostedByID: UNIQUEIDENTIFIER <<FK>>
|
|
* BeerStyleID: UNIQUEIDENTIFIER <<FK>>
|
|
* BrewedByID: UNIQUEIDENTIFIER <<FK>>
|
|
* CreatedAt: DATETIME
|
|
UpdatedAt: DATETIME
|
|
}
|
|
|
|
entity "BeerPostPhoto (*)" as BeerPhoto {
|
|
* BeerPostPhotoID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* BeerPostID: UNIQUEIDENTIFIER <<FK>>
|
|
* PhotoID: UNIQUEIDENTIFIER <<FK>>
|
|
* LinkedAt: DATETIME
|
|
}
|
|
|
|
entity "BeerPostComment (*)" as BeerComment {
|
|
* BeerPostCommentID: UNIQUEIDENTIFIER <<PK>>
|
|
--
|
|
* Comment: NVARCHAR(250)
|
|
* BeerPostID: UNIQUEIDENTIFIER <<FK>>
|
|
* CommentedByID: UNIQUEIDENTIFIER <<FK>>
|
|
* Rating: INT
|
|
* CreatedAt: DATETIME
|
|
UpdatedAt: DATETIME
|
|
}
|
|
}
|
|
|
|
' Relationships: User & Auth
|
|
User ||--o{ Cred : "has"
|
|
User ||--o| Verify : "has"
|
|
User ||--o| Avatar : "has"
|
|
Avatar }o--|| Photo : "refers to"
|
|
User ||--o{ Follow : "follows (UserAccountID)"
|
|
User ||--o{ Follow : "followed by (FollowingID)"
|
|
User ||--o{ Photo : "uploaded"
|
|
|
|
' Relationships: Location
|
|
Country ||--o{ StateProvince : "has"
|
|
StateProvince ||--o{ City : "has"
|
|
|
|
' Relationships: Brewery
|
|
User ||--o{ Brewery : "posted"
|
|
Brewery ||--o| BreweryLoc : "has"
|
|
City ||--o{ BreweryLoc : "located in"
|
|
Brewery ||--o{ BreweryPhoto : "has"
|
|
Photo ||--o{ BreweryPhoto : "linked to"
|
|
|
|
' Relationships: Beer
|
|
User ||--o{ Beer : "posted"
|
|
BeerStyle ||--o{ Beer : "categorizes"
|
|
Brewery ||--o{ Beer : "brewed"
|
|
Beer ||--o{ BeerPhoto : "has"
|
|
Photo ||--o{ BeerPhoto : "linked to"
|
|
Beer ||--o{ BeerComment : "has"
|
|
User ||--o{ BeerComment : "commented"
|
|
|
|
note bottom of User
|
|
Backed by Features.Auth/Features.UserManagement's
|
|
Dapper repositories (AuthRepository,
|
|
UserAccountRepository) - registration, credential
|
|
rotation, and verification each issue their own
|
|
inline SQL, no stored procedures
|
|
end note
|
|
|
|
note bottom of Brewery
|
|
Backed by Features.Breweries' BreweryRepository
|
|
(Dapper); create/update/delete run inline SQL
|
|
inside a transaction, with optimistic concurrency
|
|
via RowVersion
|
|
end note
|
|
|
|
@enduml
|