Update API Document

zelda 2025-07-21 18:36:02 +10:00
parent 00477d9fec
commit cc85bbcba7
1 changed files with 70 additions and 1 deletions

@ -1 +1,70 @@
Welcome to the Wiki.
# 📘 API: Lấy danh sách Scrap Items
**Endpoint**:
```
GET /api/v1/scrap-items
```
---
## 🧾 Mô tả
API này trả về danh sách các `scrap items` được lưu trong hệ thống.
> Có thể tìm hiểu sâu hơn với thư viện [`nestjs-paginate`](https://www.npmjs.com/package/nestjs-paginate), hỗ trợ các tham số phân trang và lọc tương tự.
---
## 📥 Tham số query
| Tên | Kiểu dữ liệu | Bắt buộc | Mô tả |
|-----|--------------|----------|-------|
| `filter.scrap_config.web_bid.origin_url` | `string` | ❌ | Lọc các `scrap items` theo URL gốc của `web_bid`. Hỗ trợ tìm chính xác hoặc dùng `ilike` nếu có cấu hình. |
| `page` | `number` | ❌ | Trang hiện tại (pagination). |
| `limit` | `number` | ❌ | Số lượng item mỗi trang. |
| `sortBy` | `string` | ❌ | Tên field để sắp xếp. |
| `order` | `asc` / `desc` | ❌ | Thứ tự sắp xếp. |
---
## 🧪 Ví dụ gọi API
**Request:**
```
GET /api/v1/scrap-items?filter.scrap_config.web_bid.origin_url=https://www.facebook.com&page=1&limit=10
```
---
## ✅ Response mẫu
```json
{
"data": [
{
"created_at": "2025-07-21T07:57:01.426Z",
"updated_at": "2025-07-21T07:57:01.426Z",
"id": 621,
"name": "Cisco UCS C220M5 - sydney",
"url": "https://www.facebook.com/marketplace/item/2508483002878433/?ref=search&referral_code=null&referral_story_type=post&tracking=browse_serp%3Af2500cc9-6f45-4eb1-9e7a-3f4b63c60205&__tn__=!%3AD",
"model": "2508483002878433",
"image_url": "https://scontent-syd2-1.xx.fbcdn.net/v/t45.5328-4/506322117_680945821425466_7758152392639099488_n.jpg?stp=c627.0.540.540a_dst-jpg_p180x540_tt6&_nc_cat=106&ccb=1-7&_nc_sid=247b10&_nc_ohc=Vk_tIwI2xIEQ7kNvwEvAEeR&_nc_oc=AdkUavkGV9Y37wFK7bEI-LkdLY6vgqM9WLpCiXYeOUCiYlRbNnRRKlMLLsl2S8fjyrg&_nc_zt=23&_nc_ht=scontent-syd2-1.xx&_nc_gid=_tQu3x4K0DTOJFRYAbThiA&oh=00_AfSCFfNo4vmuhs65v_Sw3DCVnIGJ9ilgXYXFleFUjmpFmw&oe=6883A92B",
"keyword": "cisco",
"current_price": 300,
"scrap_config_id": 7,
"source": "https://www.facebook.com"
},
],
"timestamp": "2025-07-21T08:00:05.989Z",
"current_page": 1,
"from": 1,
"to": 15,
"last_page": 13,
"per_page": 15,
"total": 193,
"sources": [
"https://www.facebook.com",
]
}
```