# Final Project
## Requirements
### User
- [ ] User can register/login with email and password
- [ ] User can log in with Fb/Google account
- [ ] User stay logged in across browser refresh
- [ ] User can edit your profile
- [ ] User can search other users by name
- [ ] user can see recommand in detail page
- [ ] User can sort product by category, name, time,
- [ ] User can add product to cart before they login
- [ ] User can edit them cart, and after them accept this bill, them can see status of this bill(cancel, watting..)
- [ ] User can comment, ratting
### Shop
- [ ] Shop can add,delete,edit, sale, product
- [ ] shop can see all product
- [ ] Shop can add Staff to rep message, and delete them
- [ ] Shop can accept bill from user or delete it
Socket.io:
- [ ] User can chat with shop
## Implementation
### DB Design
- User
- User Model: name, email, password, avatarUrl, phoneNumber address
- product Model: name, category, createdAt, image, price,salePrice, quantily, description,rating, review
- Review Model: from (ref User), body, createdAt
- Cart: user, product, status,createdAt
- Message Model: from (ref User), to (shop), body
- Backend
- Setup project
- npx express-generator --no-view
- npm i nodemon, add: "dev": "nodemon bin/www"
- npm i dotenv cors, add them to app.js
- remove everthing in public/
- .env: PORT=5000, MONGODB_URI=mongodb://localhost:27017/cs-final-project-trungle
- Put in helpers/utils.helper.js
- Put error handlers in app.js
- Put in mongoose connect
- Create controllers: user.controler.js, auth.controler.js, product.controler.js, cart.controler.js
- Middlewares: authentication, passport
- Socket.io
- Frontend
- Setup React app with Login/Register, redux
- Get Current user when the app restart
- Add Fb/Google Login
- UI
- Setup Cart
- Get the list of product
- Get the list of conversations
- Socket.io