Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pipeline {
stage('build') {
steps {
sh 'node --version'
sh 'npm install'
sh 'npm test'
}
}
}
Expand Down
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# BezKoder Course: Ecommerce-backend

Lesson 3.1 Setup project structure
- [x] Init the project, create some main folders
- [x] Reading env
- [x] Logger
- [x] Connect with the database

Lesson 4
- [x] Create the products, categories, brands models
- [x] Create the products API
- [x] Create the products controller
- [x] Refactoring to BaseController
- [] (optional) Unit test


Lesson 5: Upload file
- [x] API
- [x] Upload to local
- Use multer
- Handle file name
- Create temp folder if not exists
- [x] Local to Cloud
- Create google storage service, add credentials
- Call the upload service and parse the result

Lesson 6.1: Sign Up
- [x] User model
- Encrypt password
- [x] User controller, API


Lesson 6.2: Sign In
- [x] Authenticate user service
- [x] Basic Auth
- [x] JWT
- [x] Cookie Session

Lesson 6.3: Sign In With Google
- [x] PassportJS introduction
- [x] Use PassportJS to sign in with Google, and reuse JWT for managing session

Lesson 7.1: Querying, Filtering, Paging, Sorting
- [x] Insert dummy data
- [x] Design the API
- Use cases:
- category: 'laptop'
- year: 2019
- rating: [2, 3], > 2, < 3
- price: > 100, [100, 2000]
- sort by: price, rating
- search by: name

- localhost:5000/products?
&f_category=1
&f_year=2019
&f_rating_gte=2
&f_rating_lte=3

&f_price_gte=1000
&f_price_lte=2000

&s_price=asc
&s_rating=asc

&f_name_like=macbook

type: filter, sort
property: rating, price, year
operator: is, gte, lte, like
value: 100, asc, des, 'macbook'

-


41 changes: 0 additions & 41 deletions app.js

This file was deleted.

90 changes: 0 additions & 90 deletions bin/www

This file was deleted.

20 changes: 20 additions & 0 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1657418541448" clover="3.2.0">
<project timestamp="1657418541448" name="All files">
<metrics statements="11" coveredstatements="11" conditionals="2" coveredconditionals="2" methods="1" coveredmethods="1" elements="14" coveredelements="14" complexity="0" loc="11" ncloc="11" packages="1" files="1" classes="1"/>
<file name="helpers.js" path="/Users/khanh.vo/Developer/Study/Bezkoder/jenkins-simple-node-project/src/controllers/helpers.js">
<metrics statements="11" coveredstatements="11" conditionals="2" coveredconditionals="2" methods="1" coveredmethods="1"/>
<line num="1" count="1" type="cond" truecount="2" falsecount="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="4" count="1" type="stmt"/>
<line num="5" count="1" type="stmt"/>
<line num="6" count="1" type="stmt"/>
<line num="7" count="1" type="stmt"/>
<line num="8" count="1" type="stmt"/>
<line num="9" count="1" type="stmt"/>
<line num="10" count="1" type="stmt"/>
<line num="11" count="1" type="stmt"/>
</file>
</project>
</coverage>
2 changes: 2 additions & 0 deletions coverage/coverage-final.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"/Users/khanh.vo/Developer/Study/Bezkoder/jenkins-simple-node-project/src/controllers/helpers.js": {"path":"/Users/khanh.vo/Developer/Study/Bezkoder/jenkins-simple-node-project/src/controllers/helpers.js","all":false,"statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":12}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":25}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}},"4":{"start":{"line":5,"column":0},"end":{"line":5,"column":33}},"5":{"start":{"line":6,"column":0},"end":{"line":6,"column":39}},"6":{"start":{"line":7,"column":0},"end":{"line":7,"column":29}},"7":{"start":{"line":8,"column":0},"end":{"line":8,"column":29}},"8":{"start":{"line":9,"column":0},"end":{"line":9,"column":39}},"9":{"start":{"line":10,"column":0},"end":{"line":10,"column":5}},"10":{"start":{"line":11,"column":0},"end":{"line":11,"column":3}}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1},"branchMap":{"0":{"type":"branch","line":1,"loc":{"start":{"line":1,"column":0},"end":{"line":11,"column":3}},"locations":[{"start":{"line":1,"column":0},"end":{"line":11,"column":3}}]},"1":{"type":"branch","line":1,"loc":{"start":{"line":1,"column":7},"end":{"line":11,"column":3}},"locations":[{"start":{"line":1,"column":7},"end":{"line":11,"column":3}}]}},"b":{"0":[1],"1":[1]},"fnMap":{"0":{"name":"toProductModel","decl":{"start":{"line":1,"column":7},"end":{"line":11,"column":3}},"loc":{"start":{"line":1,"column":7},"end":{"line":11,"column":3}},"line":1}},"f":{"0":1}}
}
Loading