Skip to content

User Manual

aayushpatel108 edited this page Mar 8, 2022 · 17 revisions

Installing/Deploying DineSmart

Using DineSmart

Creating an Account

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.

IMG_4002

Login

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.

IMG_3560

User Profile Home Page

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.

IMG_4626

Browse Restaurants

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.

IMG_4741

Add Review

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.

IMG_4095

View Restaurant Reviews

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.

IMG_3502

Installation and Local Deployment

Clone Repository

git clone https://github.com/cs130-w22/Group-A7.git

Install Requirements

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

Migrate Database Models

python3 manage.py makemigrations
python3 manage.py migrate

Run Backend Server

python3 manage.py runserver

Run Frontend

In a new terminal,

cd ../frontend
npm start

This should redirect you to a webpage running on the local machine.

Production Deployment

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.