Add BeerStyle entity and related properties; refactor BreweryDto to remove BeerPosts

This commit is contained in:
Aaron Po
2026-08-19 20:20:42 -04:00
parent 2b2df0053f
commit 0db29f431c
8 changed files with 78 additions and 51 deletions

View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Features.Breweries</RootNamespace>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Domain\Domain.Entities\Domain.Entities.csproj" />
<ProjectReference Include="..\..\Domain\Domain.Exceptions\Domain.Exceptions.csproj" />
<ProjectReference Include="..\..\Infrastructure\Infrastructure.Sql\Infrastructure.Sql.csproj" />
<ProjectReference Include="..\..\Shared\Shared.Contracts\Shared.Contracts.csproj" />
<ProjectReference Include="..\..\Shared\Shared.Application\Shared.Application.csproj" />
</ItemGroup>
</Project>

View File

@@ -16,8 +16,6 @@ public record BreweryLocationDto(
byte[]? Coordinates
);
public record BeerPreviewDto(Guid BeerPostId, string Name, decimal ABV, int IBU);
/// <summary>A brewery post, as returned by the API.</summary>
/// <param name="UpdatedAt">The date and time of the last edit, or <see langword="null"/> if never edited.</param>
/// <param name="RowVersion">The row-version/concurrency token used to detect conflicting concurrent updates.</param>
@@ -30,6 +28,5 @@ public record BreweryDto(
DateTime CreatedAt,
DateTime? UpdatedAt,
byte[]? RowVersion,
BreweryLocationDto? Location,
List<BeerPreviewDto> BeerPosts
BreweryLocationDto? Location
);

View File

@@ -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
)),
]
)
);
}
}