Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muhammad Savero #6

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
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
296 changes: 295 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,295 @@
# e-commerce
# e-commerce

##Link Deploy
e-commerce.saveroz.com

## Usage
on server
```javascript
$ npm install
$ npm run dev
```

## REST API
All end point routes start with http://35.192.45.25
## /users end point

### **Register New User**

Register new user to the database
| Route | HTTP | Headers |
|---|---|---|
|`/users/register`|POST|`none`|

Body :
usernaname: String (Required)
password: String (Required)
email : String (Required) (Unique)
Success :
status: 201
message: 'You have successfully registered account'
error :
status: 404
message: 'failed to registered account'

### **Login User**

Login with user info
| Route | HTTP | Headers |
|---|---|---|
|`/users/login`|POST|`none`|

Body :
email: String (Required)
password: String (Required)
Success :
status: 200
message : 'Login successfull'
data: 'token'
error :
status: 404
message: 'email/password is wrong'

## /products end point

### **Create Product**

Create new product into the database
| Route | HTTP | Headers |
|---|---|---|
|`/products`|POST|`token`|
Body :
```
name: String (Required)
price: Number (Required)
image: File (Required)
stock Number (Required)
```
success :
```
status : 201
message : 'product has been created successfully'
```
error :
```
status: 404
message : 'failed to create product'
```

### **Find All Products**

Find all products in the database
| Route | HTTP | Headers |
|---|---|---|
|`/products`|GET|`token`|
Body :
none
success :
status: 200
message: 'all user's data'
error:
status: 404
message: 'data not found'

### **Find One Products**

Find one product in the database
| Route | HTTP | Headers |
|---|---|---|
|`/products/:id`|GET|`token`|
Body:
```
none
```
success :
```
status: 200
message: 'all products'
```
error :
```
status: 404
message: 'data not found'
```

### **Update product**

Update a product in the database
| Route | HTTP | Headers |
|---|---|---|
|`/products/:id`|PATCH|`token`|

Body :
```
name: String
price: Number
image: File
stock Number
```
success :
```
status: 200
message: 'update successfull'
```
error:
```
status: 404
message: 'update failed'
```
note : one of the body variable have to different from before

### **Delete Product**
Delete product in the database
| Route | HTTP | Headers |
|---|---|---|
|`/products/:id`|DELETE|`token`|

Body :
```
none
```
success :
```
status: 200
message: 'delete successfully'
```
error:
```
status: 404
message: 'failed to delete data'
```

## /carts end point

### **Create carts**

Create a new cart into the database
| Route | HTTP | Headers |
|---|---|---|
|`/carts`|POST|`token`|
Body :
```
ProductId: String (Required)
amount: Number (Required)

```
success :
```
status : 201
message : 'Cart has been created successfully'
```
error :
```
status: 404
message : 'failed to create cart'
```

### **Find All Carts**

Find all User Carts in the database
| Route | HTTP | Headers |
|---|---|---|
|`/carts`|GET|`token`|
Body :
none
success :
status: 200
message: 'all user's carts'
error:
status: 404
message: 'data not found'



### **Update cart**

Update a cart in the database
| Route | HTTP | Headers |
|---|---|---|
|`/carts/:id`|PATCH|`token`|

Body :
```
ProductId : String
amount : Number

```
success :
```
status: 200
message: 'update successfull'
```
error:
```
status: 404
message: 'update failed'
```
note : one of the body variable have to different from before

### **Delete cart**
Delete cart of user in the database
| Route | HTTP | Headers |
|---|---|---|
|`/carts/:id`|DELETE|`token`|

Body :
```
none
```
success :
```
status: 200
message: 'delete successfully'
```
error:
```
status: 404
message: 'failed to delete data'
```

## /transactions end point

### **Create transactions**

Create new transactions into the database
| Route | HTTP | Headers |
|---|---|---|
|`/transactions`|POST|`token`|
Body :
```
CartId : String (Required)
totalPrice : Number (Required)

```
success :
```
status : 201
message : 'transactions has been created successfully'
```
error :
```
status: 404
message : 'failed to create transactions'
```

### **Find All transactions**

Find all User transactions in the database
| Route | HTTP | Headers |
|---|---|---|
|`/transactions`|GET|`token`|
Body :
```
none
```
success :
```
status: 200
message: 'all user's transactions'
```
error:
```
status: 404
message: 'data not found'
```

2 changes: 2 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 1%
last 2 versions
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'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
21 changes: 21 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

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

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

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
29 changes: 29 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# client

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

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

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

### Run your tests
```
npm run test
```

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

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
Loading