using Domain.Entities; namespace Features.Breweries.Repository; /// /// Repository for CRUD operations on brewery post records. /// public interface IBreweryRepository { /// /// Retrieves a brewery post by ID, joined to its location. Returns null if no brewery post /// exists with the given ID, or if it has no associated location. /// Task GetByIdAsync(Guid id); /// /// Retrieves all brewery posts, optionally paginated, ordered by creation date descending. Posts /// without a location are included, with left null. /// /// Maximum number of rows to return. Unbounded if . /// Number of rows to skip. Treated as zero if . Task> GetAllAsync(int? limit, int? offset); /// /// Retrieves brewery posts with a set location within of /// , nearest first. Posts without coordinates are excluded. /// /// The origin point to measure distance from. /// The maximum distance, in metres, from . Task> GetAllLocationsWithinRange(CoordinateData coords, double rangeInMetres); /// /// Retrieves all brewery posts that have a set location, ordered by BreweryPostId. Posts /// without coordinates are excluded. /// Task> GetAllLocations(); /// /// Updates a brewery post's name and description, and upserts or clears its location, enforcing /// optimistic concurrency via 's RowVersion: the update is rejected /// if the row was modified since RowVersion was read. When 's /// Location is null, any existing location for the brewery is removed. /// Returns the freshly persisted brewery, including its new RowVersion. /// /// /// Thrown when no brewery exists with the given ID, or the given location's CityId does not /// exist. /// /// /// Thrown when 's RowVersion no longer matches the stored row (it was /// modified by another request since it was last read). /// Task UpdateAsync(BreweryPost brewery); /// Deletes a brewery post by ID. Its location and photos are removed via cascading foreign keys. /// Thrown when no brewery exists with the given . Task DeleteAsync(Guid id); /// Creates a new brewery post, including its location details. /// Thrown when has no Location. /// /// Thrown when 's PostedById or Location.CityId does not exist. /// Task CreateAsync(BreweryPost brewery); }