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); /// /// Updates a brewery post's name and description, and upserts or clears its location, enforcing /// optimistic concurrency via 's Timer: the update is rejected /// if the row was modified since Timer was read. When 's /// Location is null, any existing location for the brewery is removed. /// Returns the freshly persisted brewery, including its new Timer. /// /// /// Thrown when no brewery exists with the given ID, or the given location's CityId does not /// exist. /// /// /// Thrown when 's Timer 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); }