CampsiteController

class CampsiteController(val campsiteRepository: CampsiteRepository)

Controller for Campsite-related operations.

Constructors

Link copied to clipboard
constructor(campsiteRepository: CampsiteRepository)

Properties

Link copied to clipboard
Link copied to clipboard

All campsites retrieved from the repository.

Link copied to clipboard

Campsites available after applying Explore filters.

Link copied to clipboard

The current filtering error, or null if none exists.

Link copied to clipboard

Whether Explore filters are currently applied.

Link copied to clipboard

Whether campsite filtering is in progress.

Link copied to clipboard

The current campsite search query.

Functions

Link copied to clipboard
suspend fun addCampsite(campsite: Campsite)

Adds a campsite to the repository.

Link copied to clipboard
fun applyFilters(startDate: Timestamp?, endDate: Timestamp?, location: String, minGuests: Int, maxGuests: Int, minRating: Double?)

Applies filters to the campsite list in the Explore screen.

Link copied to clipboard

Clears all applied filters from the Explore screen.

Link copied to clipboard
fun getCampsite(campsiteId: String): Campsite?

Gets a Campsite given its campsiteId.

Link copied to clipboard

Gets a list Campsite made by a user.

Link copied to clipboard

Gets the campsites that match the current search query. The query is matched with the campsite name, address, and tags (ignores case).

Link copied to clipboard
fun search(query: String)

Saves the query to the searchQuery variable. An empty query means no search (show all).

Link copied to clipboard
suspend fun updateCampsite(campsiteId: String, name: String, address: String, maxOccupancyText: String, description: String, rulesPolicies: String, tags: List<String>): Boolean

Updates a Campsite detail information.