Open vuonghoang010100 opened 7 months ago
GET /products:
Filter : status= -> str (nullable = True) price=[low, high] -> low_price : int (nullable = True); high_price: int (nullable = True); categories: (1 nhóm) -> str (nullable = True) Paging: limit offset
Count format:
Filter price:
Khi chỉ truyền 1 trong 2 giá trị :low_price, high_price -> 500, Error : Internal Server Error
POS, PUT:
Error handling with attribute are unique
{
"barcode": "123456123",
"product_name": "Mì Hảo Hảo",
"unit": "goi",
"sale_price": 500,
"status": "ACTIVE"
}
Sum: Tất cả các trường unique, key khi POST và PUT đều phải kiểm tra điều kiện và trả về lỗi
Like PUT -> same barcode
-> return error, not 500: Error: Internal Server Error
Barcode:
GET /products/barcode/:barcode
with valid barcode
500 Error: Internal Server Error
product {
"id": "SP01"
"categories": "NHOM01",
...
}
NHOM01
: chưa xử lý product bị ảnh hưởng hoặc ko cho xóa
Xử lý khóa ngoại của product với categories:
- Giả sử
product { "id": "SP01" "categories": "NHOM01", ... }
- Xóa category
NHOM01
: chưa xử lý product bị ảnh hưởng hoặc ko cho xóa
Đã báo lỗi Dữ liệu đã được sử dụng.
-API:
GET /search Search : product_name, id, barcode -> paging
GET /products:
Thêm vào response:
GET /products -> tất cả product