$55
This assignment is a continuation of Assignment 1 and 2, thus all the requirements for this assignment is to be made “on top” of your Assignment 1 and 2.
Assignment 3
Application Architecture
Your application MUST be structured FULLY according to the MVC Design pattern. Thus, your views, models and controllers must be separated as per the design pattern requirements.
All sensitive credential information must be stored in environment variables. Examples include: your sendgrid access token, MongoDB connection string, etc. Implement environment variables locally using the dotenv 3rd party package.
User Registration Module
You are required to implement database functionality for your registration page that was previously implemented in Assignment 1 and 2. Thus, when a user fills out the registration form and then hits the submit button, provided that all the validation criteria were not violated, your website must then create a user account in your database.
Once the user account is created, your web application must then redirect the user to a dashboard page.
Regarding your database functionality, the following rules must be followed:
Setup and configure a MongoDB cloud service using MongoDB Atlas https://www.mongodb.com/cloud/atlas.
Connect your web application to your MongoDB database using an ODM called Mongoose.
Name your database and collections appropriately.
Ensure that the email field in your registration form is unique, thus your application must prohibit different users from having the same email in the database.
Passwords must not be stored in plain text in the database; thus, your application must store passwords in an encrypted format. You can use a 3rd party package called bcryptjs to do the aforementioned.
Note:
For MongoDB, see week 8 lecture Notes: https://web322.ca/notes/week08
For bcrytptjs, see week 11 lecture Notes : https://web322.ca/notes/week11
Authentication Module
You are required to implement a fully functional authentication module with the following features:
Your application must allow a Data Entry Clerk and customers who want to purchase meal packages, to log-in via the login form created in Assignment 1 and 2.
Upon a successful authentication (entering an email and password pair that exists in the database) a session must be created to maintain the user state until they have logged out of the application.
Upon an unsuccessful authentication, the application must display an appropriate message (Example: Sorry, you entered the wrong email and/or password)
Also, after successfully authenticating, the application must determine if the person logging in is a data entry clerk or a regular user and will be redirected to their respective dashboard.
A customer will be directed to a user dashboard and a data entry clerk will be directed to a data entry clerk dashboard.
Both dashboards, must show the user’s name (first name and last name) and a logout link
The logout link must destroy the session created when the user initially authenticated.
Specific routes can only be accessed when users are logged-in, thus those routes must be protected.
Note:
For implementing session and protecting routes in Express app, see week 11 lecture notes : https://web322.ca/notes/week11
Assignment 4
Data Entry Clerk Module
You are required to implement a Data Entry Clerk module that allow a data entry clerk to do the following:
Create Meal Packages: The Data Entry Clerk must be able to add new meal packages to the database. See the following data that must be added when a product is created:Meal Package name,
Meal Package price,
Meal Package description or details,
Meal Package food category
The number of meals inside the package
Set Meal package as a top package to be shown on the home page (or not).
Upload a photo of the meal package (to keep the project simple, only upload one image per meal package).
Ensure that all created meal packages that were entered into the database are populated on the front-end of the web application, specifically on the meal package listing page that was created in Assignment 1 and 2. Additionally, only meal packages that were set as “Top Meal Packages” should be populated in the “Top Meal Package” section of the home page. Please note, a visitor to the web application does not need to be logged in to view the meal packages that were created by the data entry clerk.
Ensure that a user can only upload an image, i.e. jpgs, gifs, or pngs, for the meal package photo.
View a list of all created meal packages.
Edit and change meal package details for a selected meal package. Example: price, title etc
Please note, a Data Entry Clerk must be logged-in to the web application to be able to do the aforementioned (create meal packages, view all created meal packages, edit and change meal package details). To facilitate the logging in of the Data Entry clerk, create a regular user in the Front-End and then long into your MongoDB Atlas account and manually change a field in the document to make allow the application to able to make the distinction between customer vs data entry clerk - I will further expound on this in class.
Assignment 5
Meal Package Description Page
Only logged in users should be able to “purchase” meal packages by adding selected meal packages to their shopping cart.
From the meal package listing page, when a user clicks on a particular meal package, they should be navigated to the Meal Package Description page of the clicked meal package and from that page they can add the meal package to their shopping cart.
Sample of a Product Description Page Example:
The Meal Package Description page of any meal package should list the following:
Meal Package Image
Meal Package title
Meal Package description
Meal Package price
No of meals within the package
Add to order
When the user clicks the “Add to order” button, the given package will be added to the user's shopping Cart.
Shopping Cart Module
The customer’s dashboard should have a link to the logged-in user shopping cart. This page must display all the meal packages that were added to the shopping cart and how much of each package was added for the given user. Also, the page should have a “Place your order” button.
See Example
When the “Place your order” button is pressed, your web application should “clean” your shopping cart, send an email to the logged in user’s email, indicating all the packages purchased and the quantity amount for each meal package purchased as well as the customer’s order total.