-
Notifications
You must be signed in to change notification settings - Fork 0
User Manual
The user is directed to create an account if they have not already. The user sets their email and password. They also provide their name and location, which are used to automatically create a UserProfile.
When the Submit button is clicked, the backend endpoint /createUser is triggered. This endpoint creates the User and UserProfile instances in the database.
Once a user has an account, they can use their email and password to log in.
Using the \login endpoint, password is validated, and a session token is created to keep the user logged in. When the user is logged in, the \getCurrentUser endpoint returns the user's email, letting the frontend know that the user has permission to execute certain actions. All user profile data, including past reviews, is saved such that it is persisted across user sessions.
Users can view their profile data, including their past reviews.
Data is fetched by the \getUserProfile endpoint, which queries the database for the current user, which is polled from the session which is a field of the Http Request from the frontend.
The user can select a location, date, cuisine, and size of party and view a list of restaurants that satisfy the query. Available reservation times are also supplied for each restaurant, and links to make the booking are provided.
This works by triggering the \browseRestaurants endpoints. Parameters are passed in as a JSON object in the HTTP Request body. Then, the Django view function associated with this endpoint calls the Scraper module, which scrapes online data using these parameters and returns the data on available restaurants. The frontend receives this response in the form of a HttpResponse object with a JSON body (JsonResponse in Django) and displays the data to the user.
Users can add their own review for a restaurant, consisting of a rating from 1-5 and text content.
This button triggers the \addReview endpoint which adds the Review to the Review table in the Database.
Users can view reviews left by other users for a restaurant.
Users can search for restaurants, and this calls the \getRestaurantReviews endpoint which queries the Review table for entries that involve a certain restaurant.
git clone https://github.com/cs130-w22/Group-A7.git
Frontend requirements
cd frontend
npm install
cd ../backend
OPTIONAL: Activate Virtual Environment:
python3 -m venv <env-name>
source <env-name>/bin/activate
Backend Requirements
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
In a new terminal,
cd ../frontend
npm start
This should redirect you to a webpage running on the local machine.
Production deployment requires creating a static build using npm build
and serving it from the backend by configuring the Django application to serve the templated version of the generated "index.html" file as the base "" url route. Then only the Django server needs to be run, and it can be deployed on any machine. There's a decent amount of configuration required, so ask us for more information! Local deployment should be sufficient to view and test out functionality.