This was created by Frank Dai and Huajie Zhong!
A project for Cornell App Dev Hack Challenge FA 2023
This is the demo video for our app
Welcome to the backend repository of Ithaca Traveler! This repository houses the server-side code and database management for our travel exploration app. The backend is designed to support the iOS and Android applications, providing a seamless and efficient experience for users.
- Flask
- SQL
- SQLalchemy
- Docker
- Google Cloud
- Weather API
- id
- name
- locations (many to many: one feature could have many corresponding locations)
- id
- longitude
- latitude
- name
- description
- address
- posts (one to many: one location might have many corresponding posts)
- features (many to many: one location could have many features)
- id
- timestamp
- comment
- location_id (the post belongs to one location)
- user_id (the post belongs to one user)
- liked_users (many to many: one post could be liked by many users)
- id
- username
- password
- posts (one to many: one user might have many posts)
- posts_liked (many to many: one user might like many posts)
- Endpoint:
/api/features/
- Method: GET
- Description: Retrieve all features.
- Response: Success - List of features in JSON format.
- Endpoint:
/api/features/<int:feature_id>/
- Method: GET
- Description: Retrieve a feature by its ID.
- Response: Success - Feature details in JSON format.
- Endpoint:
/api/features/
- Method: POST
- Description: Add a new feature.
- Request Body: JSON with "name" parameter.
- Response: Success - Empty JSON with HTTP status 201.
- Endpoint:
/api/features/<int:feature_id>/
- Method: POST
- Description: Update a feature by its ID.
- Request Body: JSON with "name" parameter.
- Response: Success - Empty JSON.
- Endpoint:
/api/features/<int:feature_id>/locations/<int:location_id>/
- Method: POST
- Description: Assign a feature to a location.
- Response: Success - Empty JSON with HTTP status 401.
- Endpoint:
/api/features/<int:feature_id>/
- Method: DELETE
- Description: Delete a feature by its ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/locations/
- Method: GET
- Description: Retrieve all locations.
- Response: Success - List of locations in JSON format.
- Endpoint:
/api/locations/features/<feature>/
- Method: GET
- Description: Retrieve location IDs associated with a feature by feature name.
- Response: Success - List of location IDs in JSON format.
- Endpoint:
/api/locations/<int:location_id>/
- Method: GET
- Description: Retrieve location details by its ID.
- Response: Success - Location details in JSON format.
- Endpoint:
/api/locations/
- Method: POST
- Description: Add a new location.
- Request Body: JSON with "longitude," "latitude," "name," "address," and optional "description" parameters.
- Response: Success - Empty JSON with HTTP status 201.
- Endpoint:
/api/locations/<int:location_id>/
- Method: POST
- Description: Update a location by its ID.
- Request Body: JSON with optional "longitude," "latitude," "name," "address" parameters.
- Response: Success - Empty JSON.
- Endpoint:
/api/locations/<int:location_id>/
- Method: DELETE
- Description: Delete a location by its ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/posts/
- Method: GET
- Description: Retrieve all posts.
- Response: Success - List of posts in JSON format.
- Endpoint:
/api/posts/<int:post_id>/
- Method: GET
- Description: Retrieve a post by its ID.
- Response: Success - Post details in JSON format.
- Endpoint:
/api/posts/locations/<int:location_id>/
- Method: GET
- Description: Retrieve posts under a specific location by ID.
- Query Parameters: "sort" (optional, values: "recent" or "likes"), "user_id" (required).
- Response: Success - List of posts in JSON format.
- Endpoint:
/api/posts/
- Method: POST
- Description: Add a new post.
- Request Body: JSON with "comment," "location_id," and "user_id" parameters.
- Response: Success - JSON with "post_id" and HTTP status 201.
- Endpoint:
/api/posts/<int:post_id>/
- Method: POST
- Description: Update a post by its ID.
- Request Body: JSON with "comment" parameter.
- Response: Success - Empty JSON.
- Endpoint:
/api/posts/<int:post_id>/like/
- Method: POST
- Description: Like or unlike a post.
- Request Body: JSON with "user_id" parameter.
- Response: Success - Empty JSON.
- Endpoint:
/api/posts/<int:post_id>/
- Method: DELETE
- Description: Delete a post by its ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/users/
- Method: GET
- Description: Retrieve all users.
- Response: Success - List of users in JSON format.
- Endpoint:
/api/users/
- Method: POST
- Description: Add a new user.
- Request Body: JSON with "username" and "password" parameters.
- Response: Success - JSON with "user_id" and HTTP status 201.
- Endpoint:
/api/users/<int:user_id>/
- Method: GET
- Description: Retrieve a user by its ID.
- Response: Success - User details in JSON format.
- Endpoint:
/api/users/<int:user_id>/
- Method: DELETE
- Description: Delete a user by its ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/users/verify/
- Method: POST
- Description: Verify user credentials.
- Request Body: JSON with "username" and "password" parameters.
- Response: Success - JSON with "verify" (True/False) and "user_id" (if verified).
- Endpoint:
/api/images/posts/<int:post_id>/
- Method: GET
- Description: Retrieve a post image by its post ID.
- Response: Image file.
- Endpoint:
/api/images/user/<int:user_id>/
- Method: GET
- Description: Retrieve a user profile image by its user ID.
- Response: Image file.
- Endpoint:
/api/images/posts/<int:post_id>/
- Method: POST
- Description: Upload a post image by its post ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/images/user/<int:user_id>/
- Method: POST
- Description: Upload a user profile image by its user ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/images/post/<int:post_id>/
- Method: DELETE
- Description: Delete a post image by its post ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/images/user/<int:user_id>/
- Method: DELETE
- Description: Delete a user profile image by its user ID.
- Response: Success - Empty JSON.
- Endpoint:
/api/weather/
- Method: GET
- Description: Obtain weather information at the given position.
- Query Parameters: "longitude" and "latitude" (sent as arguments).
- Response: Weather information in the format specified by the frontend.