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
301 changes: 301 additions & 0 deletions API-DOC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@

# ecommerce-cms
Membuat website untuk management content ecommerce ( dipakai oleh admin)

ecommerce-cms is an application to management content ecommerce. This app has :
* RESTful endpoint for asset's CRUD operation
* JSON formatted response
* Technology Includes :
- Express Js(Node Js Framework)
- Object-relation-mapping : Sequelize
- Database: Postgres
- Token Signing/verification: Json Web Token
- Password Encryption: Bcrypt

## RESTful endpoints
### POST /login
### POST /products
### GET /products
### GET /products/:id
### PUT /products/:id
### DELETE /products/:id

Global endpoints

response(500 - Server Internal Error)
``` json
{
"message" : "Invalid Server"
}
```

### POST /login
> Login User

_Request Header_
``` json
{
"not needed"
}
```

_Request Body_
``` json
{
"email": "<admin email to get insert into>",
"password": "<admin password to get insert into>"
}
```

Response :

Success:

status : 200
``` json
{
"acces_token" : "jwttoken"
}

Failed :

status : 404
{
"message": "Invalid Request"
}
```
### POST /products

> Create new products

_Request Header_
``` json
{
"access_token" : "jwttoken"
}

_Request Body_
``` json
{
"name": "<name to get insert into>",
"image_url": "<image_url to get insert into>",
"price": "<price to get insert into>",
"stock":"<stock to get insert into>",
"category":"<category to get insert into>"
}
```

Response :

Success:

status : 201
``` json

{
"id": "<given id by system>",
"name": "<name to get insert into>",
"image_url": "<image_url to get insert into>",
"price": "<price to get insert into>",
"stock":"<stock to get insert into>",
"category":"<category to get insert into>",
"createdAt": "<date>",
"updatedAt": "<date>",
}

Failed :

status : 400
{
"message": "Invalid Request"
}
```

### GET /products
> Get all products

_Request Header_
``` json
{
"not needed"
}
```

_Request Body_
``` json
{
"not needed"
}
```

Response :

Success:

status : 200
``` json
[
{
"id": "<given id by system>",
"name": "<name to get insert into>",
"image_url": "<image_url to get insert into>",
"price": "<price to get insert into>",
"stock":"<stock to get insert into>",
"category":"<category to get insert into>",
"createdAt": "<date>",
"updatedAt": "<date>",
},
....
]

Failed :

status : 400
``` json
{
"message": "Invalid Request"
}
```
### GET /products/:id
> Get one product

_Request Params_
``` json
{
"id" : "<selected id by params>"
}
```

_Request Header_
``` json
{
"acces_token" : "jwttoken"
}
```

_Request Body_
``` json
{
"not needed"
}
```

Response :

Success:

status : 200
``` json
{
"id": "<given id by system>",
"name": "<name to get insert into>",
"image_url": "<image_url to get insert into>",
"price": "<price to get insert into>",
"stock":"<stock to get insert into>",
"category":"<category to get insert into>",
"createdAt": "<date>",
"updatedAt": "<date>",
}

Failed :

status : 500
``` json
{
"message": "Invalid Server"
}
```

### PUT /products/:id

> Update or replace a product by id

_Request Params_
``` json
{
"id" : "<selected id by params>"
}
```

_Request Header_
``` json
{
"acces_token" : "jwttoken"
}
```

_Request Body_
``` json
{
"id" : "<given id by selected>",
"name": "<title to get insert into>",
"image_url": "<category to get insert into>",
"price": "<price to get insert into>",
"stock":"<price to get insert into>",
}
```

Response :

Success:

status : 201
``` json
{
"id": "<given id by system>",
"name": "<title to get insert into>",
"image_url": "<category to get insert into>",
"price": "<price to get insert into>",
"stock":"<price to get insert into>",
"createdAt": "<date>",
"updatedAt": "<date>",
}

Failed :

status : 400
{
"message": "Invalid Request"
}
```
### DELETE /products/:id

> Delete a product by id

_Request Header_
``` json
{
"acces_token" : "jwttoken"
}
```
_Request params_
```json
{
"id" : "+req.params.id"
}


Response :

Success:

status : 200
``` json
{
"message": "Sukses Delete"
}

Failed :
status : 401
``` json

status : 404
{
"message": "Error Not Found"
}
```





2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# ecommerce-cms
Membuat website untuk management content ecommerce ( dipakai oleh admin)

https://ecommerce-cms-eca20.web.app/
3 changes: 3 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead
5 changes: 5 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
17 changes: 17 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}
12 changes: 12 additions & 0 deletions client/.firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
index.html,1598169357213,e2c5d3d9aa0c7a7c602bacdfa0aa0bf8c20fbc50cd1f0a572f8cd34c959d020f
favicon.ico,1598169357214,d5451f0f0f0bcbcd433bbdf4f6e7e5d89d8ecce2650649e969ccb5e5cd499ab2
css/app.29bdef48.css,1598169357218,75a57ed17b1bbb056114d4e745eb628ef907ba0f11dcc1def395a48fd396a349
img/serbada.051748e0.png,1598169357213,9a9db2c07879f5ca0eed31f08b065931c9fab8dc874f62d7938143f7336a0ea5
js/about.220dc2b1.js,1598169357214,2fd189e3168794867c320da3ed3a878e7ebc74d51f4819ea9faa54ef7390f932
js/about.220dc2b1.js.map,1598169357374,305a01df4bb6afaf6d84871ff8b5006d481ff59b2b186f59cd41ef89a8ba7209
js/app.7ecf4e0e.js,1598169357374,58282257bde41b88cbbb5fd624fa126d5cf50a7fdae09ae3fbf985afa305325c
js/app.7ecf4e0e.js.map,1598169357377,7873ee09c2d46e6aa51123db157b9339bb207dece03beeabb56e229751982d02
css/chunk-vendors.b61b1ece.css,1598169357375,ca2a1d660b1f001488f39da4dbcbe5a6a8e6818526fcc48768735c8e9bf51299
js/chunk-vendors.6f22cb25.js,1598169357376,da4c8e5ad8557883eff68355720de8012ff19bf046abc4bcc46cdbcd7c6b9838
KutetapMenanti(PopPunkCover).mp3,1598169357378,8fccaf1bb82eedabac5e682a02e432b852d567dc9088592ec9e47946dca34dca
js/chunk-vendors.6f22cb25.js.map,1598169357380,5a5ed3a8f494a01307c9f68e83c547c3274326a0cccb9f3ed04116f34983058f
5 changes: 5 additions & 0 deletions client/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "ecommerce-cms-eca20"
}
}
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading