The front-end for this project can be found here: onelayover.
##authentication and authorization
- For all
get
requests requiring authentication/authorization, pass along the _token in the header of the request. - For all other requests, pass along _token in body of request along with any other requirements expected by that route.
get "users/"
= requires admin. Retrieves list of all users and their limited information such as username, created_at, airlineget "users/id"
= requires authentication. Retrieves detailed information of user. Returns 404 if no such user.post "users/"
= Adds new user. Expects following data to be in body in JSON format:first_name, last_name, email, username, airline.
patch "users/:id"
= requires admin or same user updates user information. Accepts all or any of the following data to be in body in JSON format:first_name, last_name, email, username, airline.
delete "users/:id"
requires admin or same user deletes user
get "layovers/"
= retrieves list of all layovers and their limited information such as city name, country name, airport code, main-img-urlget "layovers/:airport_code"
= retrieves detailed information about that layover including main image and certain amount of activities.post "layovers/"
= requires admin. adds new layover. Expects the following data to be in body in JSON format:city_name, airport_code, country_name, currency, intl (true/false), main_img_url
patch "layovers/:airport_code"
= requires admin. Updates layover informationdelete "layovers/:airport_code"
= requires admin. deletes layover
get "/layovers/:airport_code/activities"
= retrieves list of all activities for that layover with basic information such as main image, title, and brief descriptionget "/layovers/:airport_code/activities/:activity_id"
= retrieves detailed information about activitypost "/layovers/:airport_code/activities"
= creates new activitypatch/delete "layovers/:airport_code/activities/:activity_id"
= (require admin or same user) edits/delete activity
get "/layovers/:airport_code/activities/:activity_id"
= retrieves all comments for certain activitypost "/layovers/:airport_code/activities/:activity_id"
= posts comment to activitypatch/delete "/layovers/:airport_code/activities/:activity_id/:comment_id"
= (requires admin or same user) edits/delete comment
get "/layovers/:airport_code/activities/:activity_id"
= retrieves information for all images for certain activitypost "/layovers/:airport_code/activities/:activity_id"
= adds new image informationget "/layovers/:airport_code/activities/:activity_id/:photo_id"
= (requires admin or same user) edits/delete photo