High-Table-Consortium / fullstack-capstone-dockerized

0 stars 3 forks source link

Add attraction controllers (getAllAttractionSites, getAttractionSiteB… #49

Closed Tumelo2748 closed 1 month ago

Tumelo2748 commented 1 month ago

Summary

This pull request introduces the following functionality for the AttractionSite model:

Details

  1. Get All Attraction Sites:

    • GET /attractions: Fetches and returns all attraction sites from the database.
    • Status: 200 on success, 500 on failure.
  2. Get Attraction Site by ID:

    • GET /attractions/:id: Fetches a specific attraction site by its ID.
    • Status: 200 if found, 404 if not found, 500 on failure.
  3. Create New Attraction Site:

    • POST /attractions: Creates a new attraction site with fields like name, location, description, category, rating, etc.
    • Status: 201 on successful creation, 500 on failure.
  4. Update Attraction Site:

    • PUT /attractions/:id: Updates an attraction site with provided data.
    • Status: 200 on success, 404 if not found, 500 on failure.
  5. Delete Attraction Site:

    • DELETE /attractions/:id: Deletes an attraction site by ID.
    • Status: 200 on successful deletion, 404 if not found, 500 on failure.
  6. Search Attraction Sites:

    • GET /attractions/search?name=&category=&location=: Filters attraction sites based on name, category, and location. Supports partial search using case-insensitive regular expressions.
    • Status: 200 on success, 500 on failure.

Testing

Example Endpoints

Related Issues