Deploy Server : https://ecommerce-v2.herokuapp.com
Deploy Client : https://mashumarket.firebaseapp.com
How to run locally :
npm i (server side)
npm run dev (server run)
npm run serve (client side)
Login with existing account
none
{
email: <your email goes here>,
password: <your password here>
}
200 : {
data : {
id: <id>,
name: <name>,
role: <role>,
shop_name: <shopname>
},
token : <your jwt token>,
msg: 'Login success'
}
Register a new account
none
{
name: <your name here>,
phone: <your phone here>
email: <your email goes here>,
password: <your password here>
}
200 : {
data : {
id: <id>,
name: <name>,
role: <role>,
shop_name: <shopname>
},
token : <your jwt token>,
msg: 'User created'
}
Login with existing google account
none
{
idToken: <google idToken>
}
200 : {
data : {
id: <id>,
name: <name>,
role: <role>,
shop_name: <shopname>
},
token : <your jwt token>,
msg: 'Login success'
}
CREATE shop to sell item
{
token: <your jwt token>
}
{
shop_name: <shopname>
}
200 : {
msg: 'Shop created'
}
GET detail logged on user information
{
token: <your jwt token>
}
none
200 : {
"id": 6,
"name": "Admin",
"role": "premium",
"shop_name": "Admin Shop"
}
Get all products
none
none
200 : [
{
"id": 5,
"name": "Mellophone Teman",
"description": "kriiiing .. kkriiiiiiing",
"price": "12000000",
"stocks": 12,
"image_url": "https://storage-ecommerce-mashumuro.s3.ap-southeast-1.amazonaws.com/1582173137003-yamaha-mello.jpg",
"status": "new",
"category": "Brass",
"UserId": 1,
"createdAt": "2020-02-20T04:32:17.416Z",
"updatedAt": "2020-02-20T04:32:17.416Z",
"User": {
"name": "Admin",
"shop_name": "Admin Shop"
}
},
{
"id": 6,
"name": "Snare 2222222",
"description": "DRAAAAMBEEEEEEN",
"price": "19000000",
"stocks": 12,
"image_url": "https://storage-ecommerce-mashumuro.s3.ap-southeast-1.amazonaws.com/1582173291351-yamaha-snare.jpg",
"status": "second",
"category": "Battery",
"UserId": 6,
"createdAt": "2020-02-20T04:34:52.032Z",
"updatedAt": "2020-02-20T04:36:56.245Z",
"User": {
"name": "Amalya",
"shop_name": "AmelShop"
}
}
]
GET all user's products
{
token: <your jwt token>
}
none
200 : [
{
"id": 6,
"name": "Snare 2222222",
"description": "DRAAAAMBEEEEEEN",
"price": "19000000",
"stocks": 12,
"image_url": "https://storage-ecommerce-mashumuro.s3.ap-southeast-1.amazonaws.com/1582173291351-yamaha-snare.jpg",
"status": "second",
"category": "Battery",
"UserId": 6,
"createdAt": "2020-02-20T04:34:52.032Z",
"updatedAt": "2020-02-20T04:36:56.245Z",
"User": {
"name": "Amalya",
"shop_name": "AmelShop"
}
}
]
Get detail products
none
none
200 : {
"id": 5,
"name": "Mellophone Teman",
"description": "kriiiing .. kkriiiiiiing",
"price": "12000000",
"stocks": 12,
"image_url": "https://storage-ecommerce-mashumuro.s3.ap-southeast-1.amazonaws.com/1582173137003-yamaha-mello.jpg",
"status": "new",
"category": "Brass",
"UserId": 1,
"createdAt": "2020-02-20T04:32:17.416Z",
"updatedAt": "2020-02-20T04:32:17.416Z",
"User": {
"name": "Admin",
"shop_name": "Admin Shop"
}
}
Get products by category
none
none
200 : [
{
"id": 6,
"name": "Snare 2222222",
"description": "DRAAAAMBEEEEEEN",
"price": "19000000",
"stocks": 12,
"image_url": "https://storage-ecommerce-mashumuro.s3.ap-southeast-1.amazonaws.com/1582173291351-yamaha-snare.jpg",
"status": "second",
"category": "Battery",
"UserId": 6,
"createdAt": "2020-02-20T04:34:52.032Z",
"updatedAt": "2020-02-20T04:36:56.245Z",
"User": {
"name": "Amalya",
"shop_name": "AmelShop"
}
}
]
Post new products by authenticated user
{
token: <your jwt token>
}
{
name: 'Barang mewah 2',
description: 'Ini barang mewah',
price: '40000',
stocks: 7,
category: 'Brass',
status: 'new',
image_url: 'http://gambar.com'
}
200 : {
"data": {
name: 'Barang mewah 2',
description: 'Ini barang mewah',
price: '40000',
stocks: 7,
category: 'Brass',
status: 'new',
image_url: 'http://gambar.com'
},
"msg": "New product created"
}
Edit product by authenticated user
{
token: <your jwt token>
}
{
name: 'Barang mewah 2',
description: 'Ini barang mewah',
price: '40000',
stocks: 7,
category: 'Brass',
status: 'new',
image_url: 'http://gambar.com'
}
200 : {
"msg": "Product updated"
}
DELETE product by authenticated user
{
token: <your jwt token>
}
none
200 : {
"msg": "Product deleted"
}
> User errors
400: {
code: 400,
msg: <error msg>
}
401: {
code: 401,
msg: <error msg>
}
403: {
code: 403,
msg: <error msg>
}
404: {
code: 404,
msg: <error msg>
}
> Server error
500: {
code: 500,
msg: <error msg>
}
Get all users carts
{
token: <your jwt token>
}
none
200 : [
{
id: <>,
ProductId: <>,
UserId: <>,
qty: <>,
price: <>,
status: <>
}
]
Post user carts
{
token: <your jwt token>
}
{
ProductId: <>,
qty: <>,
price: <>
}
200 : [
{
id: <>,
ProductId: <>,
UserId: <>,
qty: <>,
price: <>,
status: <>
}
]
Delete from carts
{
token: <your jwt token>
}
none
200 : {
message: 'Item removed'
}
Checkout carts
{
token: <your jwt token>
}
{
cart: []
}
200 : {
message: 'Cart checkout'
}
Get all users active transaction cart status = 'check'
{
token: <your jwt token>
}
none
200 : [
{
id: <>,
ProductId: <>,
UserId: <>,
qty: <>,
price: <>,
status: 'check'
}
]
Get all users transaction cart status = 'paid'
{
token: <your jwt token>
}
none
200 : [
{
id: <>,
ProductId: <>,
UserId: <>,
qty: <>,
price: <>,
status: 'paid'
}
]
Get all users income from shop
{
token: <your jwt token>
}
none
200 : [
{
id: <>,
ProductId: <>,
CartId: <>,
UserId: <>,
totalPrice: <>,
Product: {},
Cart: {}
}
]
Post cart confirmation
{
token: <your jwt token>
}
{
totalPrice: <>
}
200 : {
id: <>,
ProductId: <>,
CartId: <>,
UserId: <>,
totalPrice: <>
}