Skip to content

d3li0n/cosc304_project

Repository files navigation

Naturly

The website can be accessed at:

Git repo:

User Accounts

  • User with no admin access: user: oe@doe.com password: pw
  • User with admin access: user: bobby.brown@hotmail.ca password: bobby

Files

  • listorder.js is now controlled by AdminController.js an only accessible by the following URL(need to be authorized to access this page) http://naturly.herokuapp.com/admin/orders
  • loaddata.js is now controlled by AdminController.js an only accessible by the following URL(need to be authorized to access this page) http://naturly.herokuapp.com/admin/connection
  • routes.js handles all the routing of the website whenever a link is clicked or a page is called.
  • controllers/StoreController.js maintains the store page: http://naturly.herokuapp.com/store , which accesses the database and grabs the products and their corresponding prices/images(implemented by the method getProducts)
  • controllers/ProductController.js maintains the product page: http://naturly.herokuapp.com/product/{product id} , which accesses the database and grabs the product information(price, category, name, images, description), reviews for the product
    • The search function is implemented by the method getProduct.
  • controllers/CartController.js controls the function of adding to the cart: http://naturly.herokuapp.com/cart, displaying items in the cart, and the checkout process.
    • Maintains a record of what is in the cart for the session managed by loadCart.
    • Displays the items and total amount of the order throught the method addProduct.
    • When it's time to checkout, cartCheckout will prompt the user to login if they aren't and give an error if the cart is empty.
    • On a successful checkout, an order is placed and orderproduct is updated in the db.
    • Once the order is placed, the cart is emptied so a user may shop again.
  • controllers/UserController.js handles the login and logout of a user: http://naturly.herokuapp.com/login.
    • isEmailValid checks if the entered email is a valid email address
    • authUser authenticates the user's login credentials and will throw an error if the account doesn't exist in the database or if the password is incorrect.
    • fethCart stores cart information, so if a user logs out with items in the cart, they will be saved to ordersummary in the database for retrieval on the next login.
    • Helps in adding to the cart in session.
    • Handles validation of customerId is a number and if customerId exists in the database.
    • Loads information about the user to http://naturly.herokuapp.com/account
    • Allows to modify information about the user http://naturly.herokuapp.com/account/settings

BONUS

  • controllers/CartController.js prompts the user to login if they aren't and orders can't be placed without logging into the website.
  • Page header updated to have links in the header to Home, Store, Account, and Administrator.

image

  • Filter by category implemented with a quick drop down box for faster catergorial filtering.

image

  • Cart page improved formatting with ProductId, Product Name, Quantity, and the Price of each item. The Order Total, Shipping Total(10%) and the Subtotal is visible large and clear for easy reading.

image

Lab 8

  • ProductController.js implements the method displayProduct which is used to show the products when their name is clicked (For example:http://naturly.herokuapp.com/product/1)
    • The id is used to to retrieve and display product information.
    • the image is displayed using both the HTML tag based on productImageUrl while also from the binary field productImage.
    • add cart and back to store are both available, also with reviews.

image

  • AdminController.js controls all admin features and checks authorization before allowing a user to view the Admin page http://naturly.herokuapp.com/admin
    • To use the admin function you need to be authorized as an admin
      • Email: bobby.brown@hotmail.ca
      • Password: bobby
    • The validate function will check if the entered email is valid and if the password is valid.
    • On the admin page we can check the database connection, sales, shipments, users, and the orders.

image

image

  • The logged in user is visible from the main page on top of the my account button at anytime.

image

image

  • AdminController.js also handles all the shipment through loadShipment and ship by verifying that there are enough products to ship the order, then if there are no conflicts, inserts the shipment into the database. The inventory is then updateded in the productinventory table. If there is insufficient inventory, a rollback is performed and quantity is updated in productinventory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published