API ini ditujukan untuk kebutuhan backend pada Aplikasi Kasir Devan Fried Chicken
To run this project, you must have Golang and postgreSQL
- go run server.go
HTTP METHOD | POST | GET | PUT | DELETE |
---|---|---|---|---|
/login | Login | - | - | - |
/register | Register User | - | - | |
/users | Detail User | Edit User | Delete User | |
/products | Add Product | List of Products | - | - |
/products/int:id | Detail Product | Edit Product | Delete Product | |
/transactions | Add Transaction | List of Transaction | - | |
/transactions/int:id | Detail Transaction | Edit Transaction | Delete Transaction | |
/product-transaction | - | List Product Transaction | - | - |
/product-transaction/int:id | - | Detail Product Transaction | Edit Product Transaction | Delete Product Transaction |
- Method : GET
- URL :
/products
- Request body : -
- Response body :
{
"message": "OK",
"data": [
{
"id": 1,
"name": "Nasi Putih",
"price": 4000
},
{
"id": 2,
"name": "Ayam Dada",
"price": 10000
},
{
"id": 3,
"name": "Ayam Paha Bawah",
"price": 7000
}
]
}
- Method : GET
- URL :
/products/<int:id>
- Request body : -
- Response body :
{
"message": "OK",
"data": {
"id": 1,
"name": "Nasi Putih",
"price": 4000
}
}
- Method : POST
- URL :
/transactions
- Request body :
[
{
"id_product": 1,
"quantity": 2
},
{
"id_product": 2,
"quantity": 1
}
]
- Response body :
{
"message": "Transaction Added",
"data": {
"id": 1,
"total_price": 18000,
"date": "17-12-2022",
"detail_transaction": [
{
"id": 1,
"id_product": 1,
"quantity": 2,
"total_price": 8000
},
{
"id": 2,
"id_product": 2,
"quantity": 1,
"total_price": 10000
}
]
}
}
-
Method : GET
-
URL :
/transactions/<int:id>
-
Request body : -
-
Response body :
{
"message": "OK",
"data": {
"id": 1,
"total_price": 18000,
"date": "17-12-2022",
"detail_transaction": [
{
"id": 1,
"id_product": 1,
"quantity": 2,
"total_price": 8000
},
{
"id": 2,
"id_product": 2,
"quantity": 1,
"total_price": 10000
}
]
}
}
- Method : DELETE
- URL :
/transactions/<int:id>
- Request body : -
- Response body:
{
"message": "Transaction 1 has been deleted",
"data": ""
}
- Yulyano Thomas Djaya - 56419764