/BED-CA1

My back-end dev project for ST0305.

Primary LanguageJavaScript

SP IT!

Checklist

  • Redo tables as some endpoint need to use table join operation
  • Create routes
    • Create user routes.
    • Create category routes.
    • Create product routes.
    • Create interest routes.
  • Create additional/advanced features.
    • Endpoint to upload/store images.
      • Validate file format. Only accept .jpg / .png and less than 1MB.
    • Hash passwords to store into db.
    • Action logging system with timestamp for each request made.
    • Promotion/Discount Feature.
  • Write documentation.
  • Add sample data.

Features

  • User registration
  • Publication of product info
  • Insertion of products
  • User reviews

Requirements

  • Create MySQL database
  • Create entity relationship diagram
  • Proper use of PK and FK constraints
  • (BONUS) Create endpoint for img upload/storage
    • Server should only accept .jpg/.png < 1MB
  • (BONUS) Retrieve product listings from server
  • (BONUS) Create endpoint and table for discounts

Grading

  • 75% - Demonstrate & satisfy endpoint functionalities.
  • 10% Advanced Features
  • 10% Proper Documentation
  • 5% Proper db and table design w/ sample data

Database

  • SP_IT

Tables

  • user
  • product
  • category
  • reviews
  • userInterest
  • discount_codes

Endpoints

/user

Route Method Description Codes
/users GET Retrieve array of all user/admin data 200/500
/users POST Add new user 201/422/500
/users/:id GET Retrieve single user data by id 200/500
/users/:id PUT Update single user data excluding id,timestamp 204/422/500

/category

Route Method Description Codes
/category GET Retrieve all categories 200/500
/category POST Insert new category, cat_id uses AI constraint 204/422/500

/product

Route Method Description Codes
/product/:id GET Retrive single product by id 200/500
/product POST Add new product 201/500
/product/:id DELETE Remove single product by id 204/500
/product/:id/review POST Add a review for product. Products can have many reviews. 201/500

/interest

Route Method Description Codes
/interest/:userid POST Insert user interest. Users can have multiple interests. 201/500

Getting Started

  1. clone repo
  2. npm i
  3. enter credentials in .env
  4. npm start