Format ./web/backend/Features/Features.Breweries

This commit is contained in:
Aaron Po
2026-06-20 15:09:41 -04:00
parent 5bef24696b
commit 58cbc5b5ba
18 changed files with 101 additions and 73 deletions

View File

@@ -12,9 +12,15 @@ namespace Features.Breweries.Queries.GetAllBreweries;
public class GetAllBreweriesHandler(IBreweryRepository repository)
: IRequestHandler<GetAllBreweriesQuery, IEnumerable<BreweryDto>>
{
public async Task<IEnumerable<BreweryDto>> Handle(GetAllBreweriesQuery request, CancellationToken cancellationToken)
public async Task<IEnumerable<BreweryDto>> Handle(
GetAllBreweriesQuery request,
CancellationToken cancellationToken
)
{
IEnumerable<BreweryPost> breweries = await repository.GetAllAsync(request.Limit, request.Offset);
IEnumerable<BreweryPost> breweries = await repository.GetAllAsync(
request.Limit,
request.Offset
);
return breweries.Select(b => b.ToDto());
}
}
}

View File

@@ -6,4 +6,4 @@ namespace Features.Breweries.Queries.GetAllBreweries;
/// <summary>
/// Retrieves a paginated list of brewery posts.
/// </summary>
public record GetAllBreweriesQuery(int? Limit, int? Offset) : IRequest<IEnumerable<BreweryDto>>;
public record GetAllBreweriesQuery(int? Limit, int? Offset) : IRequest<IEnumerable<BreweryDto>>;

View File

@@ -12,9 +12,12 @@ namespace Features.Breweries.Queries.GetBreweryById;
public class GetBreweryByIdHandler(IBreweryRepository repository)
: IRequestHandler<GetBreweryByIdQuery, BreweryDto?>
{
public async Task<BreweryDto?> Handle(GetBreweryByIdQuery request, CancellationToken cancellationToken)
public async Task<BreweryDto?> Handle(
GetBreweryByIdQuery request,
CancellationToken cancellationToken
)
{
BreweryPost? brewery = await repository.GetByIdAsync(request.BreweryPostId);
return brewery?.ToDto();
}
}
}

View File

@@ -6,4 +6,4 @@ namespace Features.Breweries.Queries.GetBreweryById;
/// <summary>
/// Retrieves a single brewery post by its unique identifier.
/// </summary>
public record GetBreweryByIdQuery(Guid BreweryPostId) : IRequest<BreweryDto?>;
public record GetBreweryByIdQuery(Guid BreweryPostId) : IRequest<BreweryDto?>;