diff --git a/web/backend/Domain/Domain.Entities/Entities/BeerPost.cs b/web/backend/Domain/Domain.Entities/Entities/BeerPost.cs index 846b43ac..b8f74994 100644 --- a/web/backend/Domain/Domain.Entities/Entities/BeerPost.cs +++ b/web/backend/Domain/Domain.Entities/Entities/BeerPost.cs @@ -24,4 +24,6 @@ public sealed class BeerPost // Navigation Properties public UserAccount? PostedBy { get; set; } public BreweryPost? BrewedBy { get; set; } + + public BeerStyle? BeerStyle { get; set; } } diff --git a/web/backend/Domain/Domain.Entities/Entities/BeerStyle.cs b/web/backend/Domain/Domain.Entities/Entities/BeerStyle.cs new file mode 100644 index 00000000..1b10e4f9 --- /dev/null +++ b/web/backend/Domain/Domain.Entities/Entities/BeerStyle.cs @@ -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; } +} diff --git a/web/backend/Domain/Domain.Entities/Entities/City.cs b/web/backend/Domain/Domain.Entities/Entities/City.cs index 9824aefd..714ca8b1 100644 --- a/web/backend/Domain/Domain.Entities/Entities/City.cs +++ b/web/backend/Domain/Domain.Entities/Entities/City.cs @@ -17,40 +17,3 @@ public sealed class City // Navigation Properties public StateProvince? StateProvince { get; set; } } - - -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; } -} - -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; } -} diff --git a/web/backend/Domain/Domain.Entities/Entities/Country.cs b/web/backend/Domain/Domain.Entities/Entities/Country.cs new file mode 100644 index 00000000..81a896a0 --- /dev/null +++ b/web/backend/Domain/Domain.Entities/Entities/Country.cs @@ -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; } +} diff --git a/web/backend/Domain/Domain.Entities/Entities/StateProvince.cs b/web/backend/Domain/Domain.Entities/Entities/StateProvince.cs new file mode 100644 index 00000000..e248f438 --- /dev/null +++ b/web/backend/Domain/Domain.Entities/Entities/StateProvince.cs @@ -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; } +} diff --git a/web/backend/Features/Features.Beers/Features.Beers.csproj b/web/backend/Features/Features.Beers/Features.Beers.csproj new file mode 100644 index 00000000..d7c3fe27 --- /dev/null +++ b/web/backend/Features/Features.Beers/Features.Beers.csproj @@ -0,0 +1,20 @@ + + + net10.0 + enable + enable + Features.Breweries + + + + + + + + + + + + + + diff --git a/web/backend/Features/Features.Breweries/Dtos/BreweryDto.cs b/web/backend/Features/Features.Breweries/Dtos/BreweryDto.cs index 414f7cb0..621aceee 100644 --- a/web/backend/Features/Features.Breweries/Dtos/BreweryDto.cs +++ b/web/backend/Features/Features.Breweries/Dtos/BreweryDto.cs @@ -16,8 +16,6 @@ public record BreweryLocationDto( byte[]? Coordinates ); -public record BeerPreviewDto(Guid BeerPostId, string Name, decimal ABV, int IBU); - /// A brewery post, as returned by the API. /// The date and time of the last edit, or if never edited. /// The row-version/concurrency token used to detect conflicting concurrent updates. @@ -30,6 +28,5 @@ public record BreweryDto( DateTime CreatedAt, DateTime? UpdatedAt, byte[]? RowVersion, - BreweryLocationDto? Location, - List BeerPosts + BreweryLocationDto? Location ); diff --git a/web/backend/Features/Features.Breweries/Dtos/BreweryDtoMapper.cs b/web/backend/Features/Features.Breweries/Dtos/BreweryDtoMapper.cs index d4ef947a..fdcc3703 100644 --- a/web/backend/Features/Features.Breweries/Dtos/BreweryDtoMapper.cs +++ b/web/backend/Features/Features.Breweries/Dtos/BreweryDtoMapper.cs @@ -37,16 +37,7 @@ public static class BreweryDtoMapper AddressLine2: brewery.Location.AddressLine2, PostalCode: brewery.Location.PostalCode, Coordinates: brewery.Location.Coordinates - ), - BeerPosts: - [ - .. brewery.BeerPosts.Select(beer => new BeerPreviewDto( - BeerPostId: beer.BeerPostId, - Name: beer.Name, - ABV: beer.ABV, - IBU: beer.IBU - )), - ] + ) ); } }