diff --git a/web/backend/Domain/Domain.Entities/Entities/BreweryPost.cs b/web/backend/Domain/Domain.Entities/Entities/BreweryPost.cs index 9bac7e6a..7d98541d 100644 --- a/web/backend/Domain/Domain.Entities/Entities/BreweryPost.cs +++ b/web/backend/Domain/Domain.Entities/Entities/BreweryPost.cs @@ -1,50 +1,14 @@ namespace Domain.Entities; -/// -/// Represents a user-submitted post about a brewery. Maps to the BreweryPost table. -/// A user account cannot be deleted while it has an associated brewery post. -/// public class BreweryPost { - /// - /// Primary key identifying this brewery post. Maps to BreweryPostID. - /// public Guid BreweryPostId { get; set; } - - /// - /// Foreign key referencing the that authored this post. Maps to PostedByID. - /// public Guid PostedById { get; set; } - - /// - /// The name of the brewery being posted about. - /// public string BreweryName { get; set; } = string.Empty; - - /// - /// Free-text description of the brewery. - /// public string Description { get; set; } = string.Empty; - - /// - /// The date and time the post was created. - /// public DateTime CreatedAt { get; set; } - - /// - /// The date and time the post was last updated, or null if it has never been updated. - /// public DateTime? UpdatedAt { get; set; } - - /// - /// SQL Server ROWVERSION concurrency token used to detect concurrent updates. null until the row has - /// been read from the database. - /// public byte[]? Timer { get; set; } - - /// - /// The associated for this post, if one has been set. This is a one-to-one - /// navigation property. - /// + public UserAccount PostedBy { get; set; } = null!; public BreweryPostLocation? Location { get; set; } } diff --git a/web/backend/Domain/Domain.Entities/Entities/BreweryPostLocation.cs b/web/backend/Domain/Domain.Entities/Entities/BreweryPostLocation.cs index 8de9e6a6..0679047c 100644 --- a/web/backend/Domain/Domain.Entities/Entities/BreweryPostLocation.cs +++ b/web/backend/Domain/Domain.Entities/Entities/BreweryPostLocation.cs @@ -1,52 +1,14 @@ namespace Domain.Entities; -/// -/// Represents the physical location of a . Maps to the BreweryPostLocation table. -/// Each brewery post has at most one location, and the location is deleted automatically when its parent post is -/// deleted. -/// public class BreweryPostLocation { - /// - /// Primary key identifying this location. Maps to BreweryPostLocationID. - /// public Guid BreweryPostLocationId { get; set; } - - /// - /// Foreign key referencing the owning . Maps to BreweryPostID; unique, enforcing a - /// one-to-one relationship. - /// public Guid BreweryPostId { get; set; } - - /// - /// The primary street address line. - /// public string AddressLine1 { get; set; } = string.Empty; - - /// - /// An optional secondary address line (e.g., suite or unit number). - /// public string? AddressLine2 { get; set; } - - /// - /// The postal/ZIP code of the location. - /// public string PostalCode { get; set; } = string.Empty; - - /// - /// Foreign key referencing the city in which the brewery is located. Maps to CityID. - /// public Guid CityId { get; set; } - - /// - /// Serialized SQL Server GEOGRAPHY value representing the geographic coordinates of the location, or - /// null if not set. - /// public byte[]? Coordinates { get; set; } - - /// - /// SQL Server ROWVERSION concurrency token used to detect concurrent updates. null until the row has - /// been read from the database. - /// public byte[]? Timer { get; set; } + public BreweryPost BreweryPost { get; set; } = null!; } diff --git a/web/backend/Domain/Domain.Entities/Entities/UserAccount.cs b/web/backend/Domain/Domain.Entities/Entities/UserAccount.cs index 6a53e26a..2931c773 100644 --- a/web/backend/Domain/Domain.Entities/Entities/UserAccount.cs +++ b/web/backend/Domain/Domain.Entities/Entities/UserAccount.cs @@ -1,55 +1,17 @@ namespace Domain.Entities; -/// -/// Represents a registered user of the application. Maps to the UserAccount table, the root entity -/// referenced by , , brewery posts, and other user-owned -/// data. -/// public class UserAccount { - /// - /// Primary key identifying this user account. Maps to UserAccountID. - /// public Guid UserAccountId { get; set; } - - /// - /// The user's unique username, used for login and display. Enforced unique at the database level. - /// public string Username { get; set; } = string.Empty; - - /// - /// The user's first name. - /// public string FirstName { get; set; } = string.Empty; - - /// - /// The user's last name. - /// public string LastName { get; set; } = string.Empty; - - /// - /// The user's email address. Enforced unique at the database level. - /// public string Email { get; set; } = string.Empty; - - /// - /// The date and time the account was created. - /// public DateTime CreatedAt { get; set; } - - /// - /// The date and time the account was last updated, or null if it has never been updated. - /// public DateTime? UpdatedAt { get; set; } - - /// - /// The user's date of birth. - /// public DateTime DateOfBirth { get; set; } - - /// - /// SQL Server ROWVERSION concurrency token used to detect concurrent updates. null until the row has - /// been read from the database. - /// public byte[]? Timer { get; set; } + public ICollection BreweryPosts { get; set; } = []; + public ICollection UserCredentials { get; set; } = []; + public UserVerification? Verification { get; set; } } diff --git a/web/backend/Domain/Domain.Entities/Entities/UserCredential.cs b/web/backend/Domain/Domain.Entities/Entities/UserCredential.cs index 4f1bf69d..4e1b7b8d 100644 --- a/web/backend/Domain/Domain.Entities/Entities/UserCredential.cs +++ b/web/backend/Domain/Domain.Entities/Entities/UserCredential.cs @@ -1,40 +1,12 @@ namespace Domain.Entities; -/// -/// Represents an issued authentication credential (refresh token) for a . -/// Maps to the UserCredential table. Credentials are deleted automatically when the owning user account is -/// deleted. -/// public class UserCredential { - /// - /// Primary key identifying this credential. Maps to UserCredentialID. - /// public Guid UserCredentialId { get; set; } - - /// - /// Foreign key referencing the owning . Maps to UserAccountID. - /// public Guid UserAccountId { get; set; } - - /// - /// The date and time the credential was issued. - /// public DateTime CreatedAt { get; set; } - - /// - /// The date and time after which the credential is no longer valid. - /// public DateTime Expiry { get; set; } - - /// - /// The Argon2 hash of the credential's secret value. The plaintext secret is never persisted. - /// public string Hash { get; set; } = string.Empty; - - /// - /// SQL Server ROWVERSION concurrency token used to detect concurrent updates. null until the row has - /// been read from the database. - /// public byte[]? Timer { get; set; } + public UserAccount UserAccount { get; set; } = null!; } diff --git a/web/backend/Domain/Domain.Entities/Entities/UserVerification.cs b/web/backend/Domain/Domain.Entities/Entities/UserVerification.cs index b091b074..651981c0 100644 --- a/web/backend/Domain/Domain.Entities/Entities/UserVerification.cs +++ b/web/backend/Domain/Domain.Entities/Entities/UserVerification.cs @@ -1,31 +1,10 @@ namespace Domain.Entities; -/// -/// Records that a has completed verification (e.g., email confirmation). -/// Maps to the UserVerification table. A user account has at most one verification record, -/// and it is deleted automatically when the owning user account is deleted. -/// public class UserVerification { - /// - /// Primary key identifying this verification record. Maps to UserVerificationID. - /// public Guid UserVerificationId { get; set; } - - /// - /// Foreign key referencing the verified . Maps to UserAccountID; unique, enforcing a - /// one-to-one relationship. - /// public Guid UserAccountId { get; set; } - - /// - /// The date and time at which the user account was verified. - /// public DateTime VerificationDateTime { get; set; } - - /// - /// SQL Server ROWVERSION concurrency token used to detect concurrent updates. null until the row has - /// been read from the database. - /// public byte[]? Timer { get; set; } + public UserAccount UserAccount { get; set; } = null!; }