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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
294 changes: 292 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,292 @@
# ecommerce-cms
Membuat website untuk management content ecommerce ( dipakai oleh admin)
# e-commerce-cms
My e-commerce-cms App is an application to sell product with E-commerce Stores. This app has :
* RESTful endpoint for Product's CRUD operation
* JSON formatted response
* Technology includes:
- TDD
- Sequelize,
- Vuex, Vue Router, Vue-CLI, Vue js (SPA),
- Express Js,
- Postgres,
- Bcrypt,
- Jason Web Token,
- authentication and authorization.
- Deploy (heroku for backend and firebase for client)

 

## RESTful endpoints

### Global Endpoints
_Response (401 - Unauthorized)_
```
{
"message": "User not authenticated"
}
```
_Response (500 - Error)_
```
{
"message": "Server internal error"
}
```

---
### GET /products
> Get all products

_Request Header_
```
{
"access_token": "<access_token>"
}
```

_Request Body_
```
not needed
```

_Response (200)_
```
[
{
"id": <show id data>,
"name": "<show name data>",
"image_url": "<show image_url data>",
"price": "<show price data>",
"stock": "<show stock data>",
"createdAt": "<show createdAt data>",
"updatedAt": "<show updatedAt data>",
}
]
```

_Response (400 - Bad Request)_
```
{
"message": "Invalid request"
}
```

_Response (401 - Not Found)_
```
{
"message": "data not found"
}
```

---
### GET /products/:id
> Get product base on requested id.

_Request Header_
```
{
"access_token": "<access_token>"
}
```

_Request Params_
```
{
"id": "<integer>"
}
```

_Request Body_
```
not needed
```

_Response (200)_
```
{
"id": <show id by requested id>,
"name": "<show name by requested id>",
"image_url": "<show image_url by requested id>",
"price": "<show price by requested id>",
"stock": "<show stock by requested id>",
"createdAt": "<show createdAt by requested id>",
"updatedAt": "<show updatedAt by requested id>",
}
```

_Response (400 - Bad Request)_
```
{
"message": "Invalid request"
}
```

_Response (404 - Not Found)_
```
{
"message": "product not found"
}
```

---
### POST /products
> Create new product

_Request Header_
```
{
"access_token": "<access_token>"
}
```

_Request Body_
```
{
"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>",
}
```

_Response (201 - Created)_
```
{
"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>",
"createdAt": "<show createdAt data>",
"updatedAt": "<show updatedAt data>",
}
```

_Response (400 - Bad Request)_
```
{
"message": "value is required"
}
```

---
### PUT /products/:id
> Get product base on requested id.

_Request Header_
```
{
"access_token": "<access_token>"
}
```

_Request Params_
```
{
"id": "<integer>"
}
```

_Request Body_
```
{
"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>",
}
```

_Response (200)_
```
{
"id": <id to get update into>,
"name": "<name to get update into>",
"image_url": "<image_url to get update into>",
"price": "<price to get update into>",
"stock": "<stock to get update into>",
"createdAt": "<createdAt to get update into>",
"updatedAt": "<updatedAt to get update into>",
}
```

_Response (400 - Bad Request)_
```
{
"message": "value is required"
}
```

_Response (404 - Bad Request)_
```
{
"message": "Data not foud"
}
```

---
### DELETE /products/:id
> Delete product with selected id

_Request Header_
```
{
"access_token": "<access_token>"
}
```

_Request Body_
```
not needed
```

_Response (200)_
```

{
"id": <contain id that deleted>,
"name": "<contain name that deleted>",
"image_url": "<contain image_url that deleted>",
"price": "<contain price that deleted>",
"stock": "<contain stock that deleted>",
"createdAt": "<contain createdAt that deleted>",
"updatedAt": "<contain updatedAt that deleted>",
}
```

_Response (404 - Not Found)_
```
{
"message": "data not found"
}
```

---
### POST /login
> Login User

_Request Header_
```
not needed
```

_Request Body_
```
{
"email": "<email to get login>",
"password": "<password to get login>"
}
```

_Response (200)_
```
{
"access_token": "<access_token>"
"id": "<user id>"
}
```

_Response (404 - Not Found)_
```
{
"message": "data not found"
}
```
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
7 changes: 7 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
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/airbnb',
],
parserOptions: {
parser: 'babel-eslint',
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
},
};
10 changes: 10 additions & 0 deletions client/.firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
favicon.ico,1598503839842,881e7692d357cc9336b88685229beafc0a3eaa83741f598ea047d6a3416687c7
index.html,1598503839842,cc856f4385a327098a32522cdf76929f8f6cb789478ed40a43ca01bd051decbe
style.css,1598503839839,ded35ecb8b0d17a2135e69de26b3b9b848bb8ab5c2a4cdcb6289ba6ac33a75d6
css/app.98dee913.css,1598503839847,4622781ec44f619ca31ac9f2f870be8d3f5145195c68968617ff9dfb04871828
js/about.58b8c0a3.js,1598503839846,29d39e43488e807a113a8e1208dc0bd542f25092b21670722113cd9a33b6dc29
js/about.58b8c0a3.js.map,1598503839847,de73556bee8919874d94f3cc3616fff2cfb25d68d245e5ad2117cebb21b450de
js/app.df4a768c.js,1598503839846,264dd08091909a5cbeeaf4599fba27cadba5c5c87f537cd732b7bab6578a9741
js/app.df4a768c.js.map,1598503839847,18cbed35b6874f27d486d598ffb87dd44919aaf1835cdb263c1b063aec3a6ef9
js/chunk-vendors.78d29f6b.js,1598503839846,f95dd41fcf1d8f3067f88ffc1e2dd758a653dc77947de7a21599e6dac7c0598a
js/chunk-vendors.78d29f6b.js.map,1598503839846,69ebea9e4a5633a862ffb9d02de7c42002b435868a3f9f3c8939e3e34ad517f0
5 changes: 5 additions & 0 deletions client/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "cms-007"
}
}
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?
24 changes: 24 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# client

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
Loading