using Domain.Entities;
using Features.Breweries.Dtos;
using Features.Breweries.Repository;
using MediatR;
namespace Features.Breweries.Queries.GetAllBreweryLocations;
///
/// Handles queries for brewery posts with locations.
///
public class GetAllBreweryLocationsHandler(IBreweryRepository repository)
: IRequestHandler>
{
///
/// Retrieves and maps every brewery post that has a location.
///
public async Task> Handle(
GetAllBreweryLocationsQuery request,
CancellationToken cancellationToken
)
{
IEnumerable breweries = await repository.GetAllLocations();
return breweries.Select(b => b.ToSimplifiedDto());
}
}