This issue is to implement full CRUD (Create, Read, Update, Delete) and search functionality for the AttractionSite model. The controller should be able to handle creating new attraction sites, updating existing ones, deleting them, retrieving all sites, fetching a site by its ID, and searching for specific attraction sites based on name, category, or location.
Detailed Requirements
Get All Attraction Sites:
Implement a function that retrieves all attraction sites.
Endpoint: GET /attractions
Get Attraction Site by ID:
Implement a function that fetches a single attraction site based on its ID.
Endpoint: GET /attractions/:id
Create New Attraction Site:
Implement a function to create a new attraction site with fields like:
name
location
description
category
rating
hours
admission_price
image
nearby_restaurants
other_activities
Endpoint: POST /attractions
Update Attraction Site:
Implement a function to update an existing attraction site.
Endpoint: PUT /attractions/:id
Delete Attraction Site:
Implement a function to delete an attraction site by ID.
Endpoint: DELETE /attractions/:id
Search Attraction Sites:
Implement a search functionality to allow filtering by:
name
category
location
Endpoint: GET /attractions/search?name=&category=&location=
Acceptance Criteria
All CRUD operations should be implemented following the structure mentioned above.
Proper error handling should be in place, including status codes for 200 (success), 404 (not found), and 500 (server error).
Implement search functionality using partial matches and case-insensitive searches.
Summary
This issue is to implement full CRUD (Create, Read, Update, Delete) and search functionality for the
AttractionSite
model. The controller should be able to handle creating new attraction sites, updating existing ones, deleting them, retrieving all sites, fetching a site by its ID, and searching for specific attraction sites based on name, category, or location.Detailed Requirements
Get All Attraction Sites:
GET /attractions
Get Attraction Site by ID:
GET /attractions/:id
Create New Attraction Site:
name
location
description
category
rating
hours
admission_price
image
nearby_restaurants
other_activities
POST /attractions
Update Attraction Site:
PUT /attractions/:id
Delete Attraction Site:
DELETE /attractions/:id
Search Attraction Sites:
name
category
location
GET /attractions/search?name=&category=&location=
Acceptance Criteria