The Product table keeps the information about each cod product.
Field | Description |
---|---|
id | A unique number for each product. |
name | The name of the product. |
type | The type or category of the product. |
small_price | The price of the product in small size. |
medium_price | The price of the product in medium size. |
large_price | The price of the product in large size. |
revenue | The total revenue generated from the product. |
total_items_sold | The total number of items sold of the product. |
This table contains details about the cashier.
Field | Description |
---|---|
id | A unique number for each cashier. |
user_name | The login name for the cashier. |
full_name | The full name of the cashier. |
password | The password for the cashier's account. |
Records details of each sale transaction.
Field | Description |
---|---|
id | A unique number for each sale record. |
transaction_id | A reference to the transaction this sale is part of. |
product_id | The identifier for the product being sold. |
size | The size of the product sold. |
price | The price at which the product is sold. |
subtotal | The total price for all items before any discounts or taxes. |
quantity | The number of items of the product sold. |
Keeps a record of each transaction made.
Field | Description |
---|---|
id | A unique number for each transaction. |
transaction_date | The date when the transaction occurred. |
cashier_id | The identifier for the cashier who processed the transaction. |
customer_name | The name of the customer involved in the transaction. |
cash | The amount of cash given by the customer. |
change_amount | The amount of change returned to the customer. |
time_served | The time it took to serve the customer. |
status | The status of the transaction (e.g., true: completed, false: Queeing). |
total | The total amount of the transaction. |
POST /api/v1/products
Input
{
"name": "hot tea",
"type": "tea",
"small_price": "20",
"medium_price": "30",
"large_price": "40"
}
Output
{
"id": 5,
"name": "hot tea",
"type": "tea",
"small_price": 20,
"medium_price": 30,
"large_price": 40,
"revenue": 0,
"total_items_sold": 0
}
GET /api/v1/products
Output
[
{
"id": 1,
"name": "thrdy",
"type": "espresso",
"small_price": 20.00,
"medium_price": 30.00,
"large_price": 10.00,
"revenue": 0.00,
"total_items_sold": 0.00
},
...
]
PUT /api/v1/products/3
Input
{
"name": "Espressp",
"type": "Latte",
"small_price": "40",
"medium_price": "50",
"large_price": "60"
}
Output
{
"id": 3,
"name": "Espressp",
"type": "Latte",
"small_price": 40,
"medium_price": 50,
"large_price": 60,
"revenue": 0.00,
"total_items_sold": 0.00
}
GET /api/v1/products/5
Output
{
"id": 5,
"name": "hot tea",
"type": "tea",
"small_price": 20.00,
"medium_price": 30.00,
"large_price": 40.00,
"revenue": 0.00,
"total_items_sold": 0.00
}
DELETE /api/v1/products/2
No content is returned upon successful deletion.
POST /api/v1/transaction
Input
{
"cashier_id": "2",
"customer_name": "dingdong dantes",
"cash": "100",
"change_amount": "10",
"time_served": "5 minutes and 5 seconds",
"status": true,
"total": 90
}
Output
{
"id": 2,
"cashier_id": 2,
"transaction_date": "2024-01-17T10:16:02.816+00:00",
"customer_name": "dingdong dantes",
"cash": 100,
"change_amount": 10,
"time_served": "5 minutes and 5 seconds",
"status": true,
"total": 90
}
GET /api/v1/transaction
Output
[
{
"id": 1,
"cashier_id": 1,
"transaction_date": "2024-01-17T09:47:41.000+00:00",
"customer_name": "howard bayquen",
"cash": 200,
"change_amount": 20,
"time_served": "10 minutes and 5 seconds",
"status": true,
"total": 120
},
...
]
GET /api/v1/transaction/2
Output
{
"id": 2,
"cashier_id": 2,
"transaction_date": "2024-01-17T10:16:02.000+00:00",
"customer_name": "dingdong dantes",
"cash": 100,
"change_amount": 10,
"time_served": "5 minutes and 5 seconds",
"status": true,
"total": 90
}