mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
* Remove restating comments in backend * Remove restating comments in frontend stories * Remove restating comments in pipeline * Remove restating comments in pipeline scripts * Restore location-clear comment in BreweryRepository * Remove stale/restating comments found in second pass * Restore mock curated-data branch comment in main.cc * Remove more restating/filler comments in backend * Document account-management endpoints, compose files, and env generator * Squashed commit of the following: commit a8a5b8abd9969859c695092fae6990d03b2135ed Author: Aaron Po <aaron.po97@gmail.com> Date: Sun Aug 23 23:53:56 2026 -0400 Add reverse geocoding for brewery street addresses (#245) * Add geocoding to seed application, remove postal codes from generator Update comments * Update pipeline class diagram for OpenAI generator * Update pipeline activity diagram for brewery coordinates and OpenAI backend * Add mailpit, production, db-only, and minimal environments to deployment diagram * Fix authentication flow diagram for Identity migration * Add account-management flows to authentication diagram * Fix database schema diagram note referencing removed AuthRepository
209 lines
5.4 KiB
Plaintext
209 lines
5.4 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
|
|
Auth reads/writes (registration, login, credential
|
|
rotation, verification) go through ASP.NET Core
|
|
Identity's UserManager<ApplicationUser>, backed by
|
|
Features.Auth's DapperUserStore - inline SQL, no
|
|
stored procedures. Profile data still goes through
|
|
Features.UserManagement's UserAccountRepository.
|
|
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
|