Ini merupakan dokumentasi final project untuk divisi backend Intern AI di JATIS MOBILE. by: Muhammad Inayatulloh
Adapun, toko online sederhana ini bisa melakukan hal hal berikut :
- Admin
- Registrasi
- Login
- Melihat semua data user, dan merchant
- Melihat semua orderan
- Melihat semua review
- Merchant
- Registrasi
- Login
- Manage data profile merhant (Create, Read, Update, Delete)
- Manage seluruh produk (Create, Read, Update, Delete)
- Update status item orderan (Approve -> Sending)
- User
- Registrasi
- Login
- Manage data profile user (Create, Read, Update, Delete)
- Melihat produk
- Melihat detail produk
- Melihat review produk
- Membeli produk
- Melihat riwayat orderan
- Update status orderan (On Process -> Confirmed)
- Membuat review produk dari orderan yang sudah selesai
Skema database yang digunakan dalam project ini bisa dilihat detailnya di: dbdiagram
referensi: gofood, shopee
- Database yang digunakan adalah
MySQL
- Terdapat 6 services, yaitu :
- Auth
- User
- Merchant
- Product
- Order
- Review
- Package yg dibutuhkan :
Nama Package | Fungsi |
---|---|
github.com/labstack/echo |
Framework API |
golang.org/x/crypto |
Hash dan Verify Password |
github.com/golang-jwt/jwt |
Generate dan Verify Token |
gorm.io/gorm |
ORM di gGolang |
gorm.io/drivers/mysql |
Driver untuk ORM |
github.com/go-playground/validator/v10 |
Validator Input User |
github.com/joho/godotenv |
Env di Golang |
Berfungsi untuk melakukan registrasi. Fitur ini akan melakukan registrasi untuk admin
, user
, atau merchant
.
Request Body :
{
"email" : "string", # must be a valid email
"password" : "string",
"role" : "string" #must be a valid role
}
Notes : Pada proses ini, password
akan di hash menggunakan library crypto
Response Body :
{
"status" : 201, # created
"message" : "REGISTER_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "REGISTER_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk melakukan login seluruh pengguna
Request Body :
{
"email" : "string", # must be a valid email
"password" : "string"
}
Notes : Pada proses ini, password
akan di verify menggunakan library crypto
Response Body :
{
"status" : 200,
"message" : "LOGIN_SUCCESS",
"payload" : {
"token" : "string" # JWT
}
}
Notes : Pada proses ini, akan me-generate token menggunakan JWT
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "LOGIN_FAIL",
"error" : "BAD_REQUEST"
}
Berfungsi untuk create user. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"name": "string",
"gender": "string",
"phone_number": "string", #Phone Number
"pict_url": "string" #Pict Url
}
Response Body
{
"status" : 201,
"message" : "CREATE_USER_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "CREATE_USER_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk mengubah data user yang sedang login. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"name": "string",
"gender": "string",
"phone_number": "08xxxxxxxxxxx", #Phone Number
"pict_url": "string" #Pict Url
}
Response Body
{
"status" : 200,
"message" : "UPDATE_USER_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "UPDATE_USER_FAILED",
"error" : "BAD_REQUEST"
}
Akan menampilkan detail profile dari user yang sedang login. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Response Body
{
"status" : 200,
"message" : "GET_USER_PROFILE_SUCCESS",
"payload": {
"id": 1,
"name": "string",
"gender": "string",
"phone_number": "08xxxxxxxxxxx",
"pict_url": "string",
"address": {
"address_tag": "string",
"city_id": "string",
"province_id": "string",
"street": "string"
},
"auth": {
"email": "[email protected]"
}
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_USER_PROFILE_FAILED",
"error" : "UNAUTHORIZED"
}
Akan menampilkan seluruh data users. Endpoint ini hanya berlaku untuk admin
.
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status" : 200,
"message" : "GET_ALL_USERS_SUCCESS",
"payload" : [
{
"id": 1,
"name": "string",
"gender": "string",
"phone_number": "08xxxxxxxxxxx",
"pict_url": "string",
"address": {
"address_tag": "string",
"city_id": "string",
"province_id": "string",
"street": "string"
},
"auth": {
"email": "[email protected]"
}
}
],
"query" : {
"limit" : 25, # default is 25
"page" : 1, # default is 1
"total" : 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_USERS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Berfungsi untuk create data alamat user. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"street": "string",
"city_id": "string",
"province_id": "string",
"address_tag": "string"
}
Notes : Pada proses ini, akan diberikan default "activate" : "y"
, jika tidak ada alamat terdaftar pada akun user.
Response Body
{
"status" : 201,
"message" : "CREATE_USER_ADDRESS_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "CREATE_USER_ADDRESS_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk mengubah data alamat user. Endpoint ini hanya berlaku untuk user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Request Body
{
"street": "string",
"city_id": "string",
"province_id": "string",
"address_tag": "string"
}
Response Body
{
"status" : 200,
"message" : "UPDATE_USER_ADDRESS_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "UPDATE_USER_ADDRESS_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk menghapus data alamat user. Endpoint ini hanya berlaku untuk user
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status" : 200,
"message" : "DELETE_USER_ADDRESS_SUCCESS"
}
Notes : Pada proses ini, data alamat user yang activate
tidak akan bisa dihapus.
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Bad request, or others...
"message" : "DELETE_USER_ADDRESS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan detail data alamat user. Endpoint ini hanya berlaku untuk user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_USER_ADDRESS_SUCCESS",
"payload": {
"id": 1,
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxxx"
},
"address": {
"city_id": "string",
"province_id": "string",
"street": "string"
},
"address_tag": "string",
"activate": "n",
"created_at": "datetime",
"updated_at": "timestamp",
"deleted_at": "datetime"
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_USER_ADDRESS_FAILED",
"error" : "UNAUTHORIZED"
}
Akan menampilkan seluruh data alamat user yang sedang login. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status": 200,
"message": "GET_ALL_USER_ADDRESSES_SUCCESS",
"payload": [
{
"id": 1,
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxxx"
},
"address": {
"city_id": "string",
"province_id": "string",
"street": "string"
},
"address_tag": "string",
"activate": "y",
"created_at": "datetime",
"updated_at": "timestamp",
"deleted_at": "datetime"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_USER_ADDRESSES_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Ini berfungsi untuk mengubah status data alamat user yang aktif digunakan. Endpoint ini hanya bisa di akses oleh user
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Request Body
{
"activate": "y"
}
Notes : Pada proses ini, data alamat yang memiliki status activate aktif akan dinon-aktifkan. Jadi tiap user hanya memiliki satu data alamat aktif.
List Aktifasi:
"y"
: aktif"n"
: non-aktif
Response Body
{
"status": 202,
"message": "UPDATE_ACTIVATE_ADDRESS_SUCCESS"
}
Berfungsi untuk create merchant. Endpoint ini hanya berlaku untuk merchant
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"name": "string",
"phone_number": "08xxxxxxxxxx",
"street": "string",
"city_id": "string",
"province_id": "string",
"pict_url": "string"
}
Response Body
{
"status" : 201,
"message" : "CREATE_MERCHANT_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "CREATE_MERCHANT_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk mengubah data merchant yang sedang login. Endpoint ini hanya berlaku untuk merchant
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"name": "string",
"phone_number": "08xxxxxxxxxx",
"street": "string",
"city_id": "string",
"province_id": "string",
"pict_url": "string"
}
Response Body
{
"status" : 200,
"message" : "UPDATE_MERCHANT_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "UPDATE_MERCHANT_FAILED",
"error" : "BAD_REQUEST"
}
Akan menampilkan seluruh data merchants. Endpoint ini hanya berlaku untuk admin
.
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status": 200,
"message": "GET_ALL_MERCHANTS_SUCCESS",
"payload": [
{
"id": 2,
"name": "string",
"phone_number": "08xxxxxxxxxxx",
"pict_url": "string",
"address": {
"city_id": "string",
"province_id": "string",
"street": "string"
},
"auth": {
"email": "[email protected]"
}
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_MERCHANTS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan detail profile dari merchant yang sedang login. Endpoint ini hanya berlaku untuk merchant
.
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_MERCHANT_PROFILE_SUCCESS",
"payload": {
"id": 2,
"name": "string",
"phone_number": "08xxxxxxxxxx",
"pict_url": "string",
"address": {
"city_id": "string",
"province_id": "string",
"street": "string"
},
"auth": {
"email": "[email protected]"
}
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_MERCHANT_PROFILE_FAILED",
"error" : "UNAUTHORIZED"
}
Berfungsi untuk create product dari merchant yang sedang login. Endpoint ini hanya berlaku untuk merchant
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"name" : "string",
"category" : "string",
"desc" : "string",
"price" : 10000000, #int
"stock" : 10, #int
"weight" : 1000, #int
"img_url" : "string"
}
Response Body
{
"status" : 201,
"message" : "CREATE_PRODUCT_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "CREATE_PRODUCT_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk mengubah data product. Endpoint ini hanya berlaku untuk merchant
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Request Body
{
"name" : "string",
"category" : "string",
"desc" : "string",
"price" : 10000000, #int
"stock" : 10, #int
"weight" : 1000, #int
"img_url" : "string"
}
Response Body
{
"status" : 200,
"message" : "UPDATE_PRODUCT_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "UPDATE_PRODUCT_FAILED",
"error" : "BAD_REQUEST"
}
Berfungsi untuk menghapus data product. Endpoint ini hanya berlaku untuk merchant
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
{
"status" : 200,
"message" : "DELETE_PRODUCT_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Bad request, or others...
"message" : "DELETE_PRODUCT_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan seluruh data product. Endpoint ini bisa diakses seluruh pengguna tanpa login.
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status": 200,
"message": "GET_ALL_PRODUCTS_SUCCESS",
"payload": [
{
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"category": "string",
"name": "string",
"desc": "string",
"price": 10000000,
"stock": 10,
"weight": 1000,
"img_url": "string"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_PRODUCTS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan seluruh data product merchant yang dipilih. Endpoint ini bisa diakses seluruh pengguna tanpa login.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status": 200,
"message": "GET_ALL_MERCHANT_PRODUCTS_SUCCESS",
"payload": [
{
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"category": "string",
"name": "string",
"desc": "string",
"price": 10000000,
"stock": 10,
"weight": 1000,
"img_url": "string"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_MERCHANT_PRODUCTS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan detail product yang dipilih. Endpoint ini bisa diakses seluruh pengguna tanpa login.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_PRODUCT_SUCCESS",
"payload": {
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"category": "string",
"name": "string",
"desc": "string",
"price": 10000000,
"stock": 10,
"weight": 1000,
"img_url": "string"
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_PRODUCT_FAILED",
"error" : "UNAUTHORIZED"
}
Ini berfungsi untuk inquiry transaksi. Pada proses ini, akan dilakukan pengecekan pesanan. Proses ini hanya bisa dilakukan oleh user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"items":[{
"product_id" : 1, #int
"quantity" : 5, #int
"notes": "string"
},
{
"product_id" : 6, #int
"quantity" : 2, #int
"notes": "string"
}
]
}
Notes : Pada proses ini, akan melakukan pengecekan ke stok product, apakah stok masih tersedia atau tidak.
Response Body
{
"status": 201,
"message": "INQUIRY_ORDER_SUCCESS",
"payload": {
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxxx",
"email": "[email protected]"
},
"order": [
{
"item": {
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 5,
"notes": "string"
},
{
"item": {
"id": 6,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 2,
"notes": "string"
}
],
"total_weight": 7000,
"total_price": 70000000
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 422, # Unprocessable entity, or others...
"message" : "INQUIRY_ORDER_FAILED",
"error" : "UNPROCESSABLE_ENTITY"
}
Ini berfungsi untuk konfirmasi order. Pada proses ini, akan dilakukan proses update stok pada produk dan insert ke table order. Proses ini hanya bisa dilakukan oleh user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"items":[{
"product_id" : 1, #int
"quantity" : 5, #int
"notes": "string"
},
{
"product_id" : 6, #int
"quantity" : 2, #int
"notes": "string"
}
]
}
Notes : Pada proses ini, akan melakukan pengecekan ke stok product, apakah stok masih tersedia atau tidak. Secara default, status yang di set adalah ON_PROCESS
Response Body
{
"status" : 200,
"message" : "CONFIRM_ORDER_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Bad request, or others...
"message" : "CONFIRM_ORDER_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Ini berfungsi untuk melihat riwayat order user yang sedang login.
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ALL_USER_ORDER_HISTORIES_SUCCESS",
"payload": [
{
"id": 1,
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxxxx",
"email": "[email protected]"
},
"order": [
{
"item": {
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 5,
"notes": ""
},
{
"item": {
"id": 6,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 2,
"notes": ""
}
],
"total_weight": 7000,
"total_price": 70000000,
"status": "string", #ON_PROCESS, CONFIRMED
"created_at": "datetime",
"updated_at": "timestamp",
"deleted_at": "datetime"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Ini berfungsi untuk melihat riwayat transaction seluruh user. Endpoint ini hanya bisa di akses oleh admin
.
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ALL_ORDER_HISTORIES_SUCCESS",
"payload": [
{
"id": 1,
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxxxx",
"email": "[email protected]"
},
"order": [
{
"item": {
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 5,
"notes": ""
},
{
"item": {
"id": 6,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 2,
"notes": ""
}
],
"total_weight": 7000,
"total_price": 70000000,
"status": "string", #ON_PROCESS, CONFIRMED
"created_at": "datetime",
"updated_at": "timestamp",
"deleted_at": "datetime"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Akan menampilkan detail order yang dipilih. Endpoint ini hanya bisa diakses oleh user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ORDER_SUCCESS",
"payload": {
"id": 1,
"user": {
"id": 1,
"name": "string",
"phone_number": "08xxxxxxxxx",
"email": "[email protected]"
},
"order": [
{
"item": {
"id": 1,
"merchant": {
"id": 2,
"name": "string"
},
"name": "string",
"weight": 1000,
"price": 10000000,
"img_url": "string"
},
"quantity": 5,
"notes": ""
}
],
"total_weight": 5000,
"total_price": 50000000,
"status": "string", #ON_PROCESS, CONFIRMED
"created_at": "datetime",
"updated_at": "timestamp",
"deleted_at": "datetime"
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_ORDER_FAILED",
"error" : "UNAUTHORIZED"
}
Ini berfungsi untuk mengubah status order user. Endpoint ini hanya bisa di akses oleh user
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Request Body
{
"status" : "string"
}
List status :
- ON_PROCESS
- CONFIRMED
Response Body
{
"status" : 200,
"message" : "UPDATE_STATUS_ORDER_SUCCESS"
}
Ini berfungsi untuk mengubah status item order. Endpoint ini hanya bisa di akses oleh merchant
Params
- orderId :
int
| required - productId :
int
| required
Request Headers
Authorization : Bearer <token>
Request Body
{
"status" : "string"
}
List status :
- WAITING
- PICKUP
- ON THE WAY
- ARRIVED
Response Body
{
"status" : 200,
"message" : "UPDATE_STATUS_ORDER_ITEM_SUCCESS"
}
Berfungsi untuk create review product by order. Endpoint ini hanya berlaku untuk user
.
Request Headers
Authorization : Bearer <token>
Request Body
{
"order_id": 1,
"product_id" : 1,
"rating" : 5,
"notes" : "string",
"img_url" : "tring"
}
Response Body
{
"status" : 201,
"message" : "CREATE_REVIEW_SUCCESS"
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 400, # Bad request, or others...
"message" : "CREATE_REVIEW_FAILED",
"error" : "BAD_REQUEST"
}
Akan menampilkan seluruh data reviews. Endpoint ini hanya bisa diakses oleh admin
.
Request Headers
Authorization : Bearer <token>
Query String
- limit :
int
with default is 25 | optional - page :
int
with default is 1 | optional
Response Body
{
"status": 200,
"message": "GET_ALL_REVIEWS_SUCCESS",
"payload": [
{
"id": 1,
"order_id": 1,
"user": {
"id": 1,
"name": "string"
},
"product": {
"id": 1,
"name": "string"
},
"rating": 5,
"notes": "string",
"img_url": "string"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_REVIEWS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan detail review yang dipilih. Endpoint ini hanya bisa diakses oleh user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_REVIEW_SUCCESS",
"payload": {
"id": 1,
"order_id": 1,
"user": {
"id": 1,
"name": "string"
},
"product": {
"id": 1,
"name": "string"
},
"rating": 5,
"notes": "string",
"img_url": "string"
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 401, # Unauthorized, Not Found, or others...
"message" : "GET_REVIEW_FAILED",
"error" : "UNAUTHORIZED"
}
Akan menampilkan seluruh data review dari product yang dipilih. Endpoint ini bisa diakses semua pengguna tanpa login.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ALL_PRODUCT_REVIEWS_SUCCESS",
"payload": [
{
"id": 1,
"order_id": 1,
"user": {
"id": 1,
"name": "string"
},
"product": {
"id": 1,
"name": "string"
},
"rating": 5,
"notes": "string",
"img_url": "string"
}
],
"query": {
"limit": 25,
"page": 1,
"total": 1
}
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_PRODUCT_REVIEWS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan seluruh data review dari order yang dipilih. Endpoint ini hanya bisa diakses oleh user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ALL_ORDER_REVIEWS_SUCCESS",
"payload": [
{
"id": 1,
"order_id": 1,
"user": {
"id": 1,
"name": "string"
},
"product": {
"id": 1,
"name": "string"
},
"rating": 5,
"notes": "string",
"img_url": "string"
}
]
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_ORDER_REVIEWS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}
Akan menampilkan seluruh data review dari user yang dipilih. Endpoint ini hanya bisa diakses oleh user
.
Params
- id :
int
| required
Request Headers
Authorization : Bearer <token>
Response Body
{
"status": 200,
"message": "GET_ALL_USER_REVIEWS_SUCCESS",
"payload": [
{
"id": 1,
"order_id": 1,
"user": {
"id": 1,
"name": "string"
},
"product": {
"id": 1,
"name": "string"
},
"rating": 5,
"notes": "string",
"img_url": "string"
}
]
}
Jika gagal, maka akan menghasilkan response :
{
"status" : 403, # Forbidden, Not Found, or others...
"message" : "GET_ALL_USER_REVIEWS_FAILED",
"error" : "FORBIDDEN_ACCESS"
}