Add API DOC
						commit
						7b2a5122c6
					
				| 
						 | 
					@ -0,0 +1,132 @@
 | 
				
			||||||
 | 
					# Products API
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 1. Create Product
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Endpoint:**  
 | 
				
			||||||
 | 
					`POST /products`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Description:**  
 | 
				
			||||||
 | 
					Tạo mới một sản phẩm với đầy đủ thông tin chi tiết.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Request Body:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| Field       | Type     | Required | Description                                  | Example                                       |
 | 
				
			||||||
 | 
					|-------------|----------|----------|----------------------------------------------|-----------------------------------------------|
 | 
				
			||||||
 | 
					| images      | string[] | Yes      | Danh sách URL ảnh sản phẩm                   | ["https://example.com/img1.jpg"]              |
 | 
				
			||||||
 | 
					| title       | string   | Yes      | Tên sản phẩm                                 | "Áo thun nam"                                 |
 | 
				
			||||||
 | 
					| price       | number   | Yes      | Giá sản phẩm                                 | 199000                                        |
 | 
				
			||||||
 | 
					| category    | string   | Yes      | Danh mục sản phẩm                            | "Clothes"                                     |
 | 
				
			||||||
 | 
					| condition   | string   | Yes      | Tình trạng sản phẩm                          | "new"                                         |
 | 
				
			||||||
 | 
					| brand       | string   | No       | Thương hiệu sản phẩm                         | "Nike"                                        |
 | 
				
			||||||
 | 
					| description | string   | Yes      | Mô tả sản phẩm                               | "Áo thun nam thể thao"                        |
 | 
				
			||||||
 | 
					| tags        | string[] | No       | Danh sách tags                               | ["thể thao", "hàng mới"]                      |
 | 
				
			||||||
 | 
					| sku         | string   | Yes      | SKU sản phẩm (duy nhất)                      | "SKU001"                                      |
 | 
				
			||||||
 | 
					| location    | string   | No       | Địa điểm lưu kho hoặc nơi bán                | "Hà Nội"                                      |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Example Request:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  "images": ["https://example.com/img1.jpg"],
 | 
				
			||||||
 | 
					  "title": "Áo thun nam",
 | 
				
			||||||
 | 
					  "price": 199000,
 | 
				
			||||||
 | 
					  "category": "Clothes",
 | 
				
			||||||
 | 
					  "condition": "new",
 | 
				
			||||||
 | 
					  "brand": "Nike",
 | 
				
			||||||
 | 
					  "description": "Áo thun nam thể thao",
 | 
				
			||||||
 | 
					  "tags": ["thể thao", "hàng mới"],
 | 
				
			||||||
 | 
					  "sku": "SKU001",
 | 
				
			||||||
 | 
					  "location": "Hà Nội"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Response (201 Created):**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    "message": "Success!",
 | 
				
			||||||
 | 
					    "status_code": 200,
 | 
				
			||||||
 | 
					    "data": {
 | 
				
			||||||
 | 
					        "images": [
 | 
				
			||||||
 | 
					            "https://example.com/images/product1.jpg",
 | 
				
			||||||
 | 
					            "https://example.com/images/product2.jpg"
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        "title": "MacBook Pro 14-inch 2023",
 | 
				
			||||||
 | 
					        "price": 2499.99,
 | 
				
			||||||
 | 
					        "category": "Laptops",
 | 
				
			||||||
 | 
					        "condition": "New",
 | 
				
			||||||
 | 
					        "brand": "Apple",
 | 
				
			||||||
 | 
					        "description": "MacBook Pro 14-inch với chip M2 Pro, 16GB RAM, 512GB SSD. Bảo hành chính hãng 12 tháng.",
 | 
				
			||||||
 | 
					        "tags": [
 | 
				
			||||||
 | 
					            "macbook",
 | 
				
			||||||
 | 
					            "laptop",
 | 
				
			||||||
 | 
					            "apple"
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        "sku": "MBP14-2023-512GBs",
 | 
				
			||||||
 | 
					        "location": "Hanoi, Vietnam",
 | 
				
			||||||
 | 
					        "created_at": "2025-08-11T21:09:14.453Z",
 | 
				
			||||||
 | 
					        "updated_at": "2025-08-11T21:09:14.453Z",
 | 
				
			||||||
 | 
					        "id": 14
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "timestamp": "2025-08-12T04:09:14.461Z"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 2. Publish Product
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Endpoint:**  
 | 
				
			||||||
 | 
					`POST /products/publist/:id`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Description:**  
 | 
				
			||||||
 | 
					Đưa sản phẩm lên trạng thái **public** để hiển thị cho khách hàng.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Path Parameters:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| Parameter | Type   | Required | Description              | Example |
 | 
				
			||||||
 | 
					|-----------|--------|----------|--------------------------|---------|
 | 
				
			||||||
 | 
					| id        | number | Yes      | ID của sản phẩm cần publish | 1       |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Example Request:**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					POST /products/publist/1
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Response (200 OK):**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```json
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    "message": "Success!",
 | 
				
			||||||
 | 
					    "status_code": 200,
 | 
				
			||||||
 | 
					    "data": {
 | 
				
			||||||
 | 
					        "created_at": "2025-08-11T18:26:23.580Z",
 | 
				
			||||||
 | 
					        "updated_at": "2025-08-11T18:26:23.580Z",
 | 
				
			||||||
 | 
					        "id": 11,
 | 
				
			||||||
 | 
					        "images": [
 | 
				
			||||||
 | 
					            "http://localhost:4000/api/v1/medias/products/Tesstsees/product-1754961983572.png",
 | 
				
			||||||
 | 
					            "http://localhost:4000/api/v1/medias/products/Tesstsees/product-1754961983579.png"
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        "title": "Tesstsees",
 | 
				
			||||||
 | 
					        "price": "12",
 | 
				
			||||||
 | 
					        "category": "tools",
 | 
				
			||||||
 | 
					        "condition": "New",
 | 
				
			||||||
 | 
					        "brand": "cisco",
 | 
				
			||||||
 | 
					        "description": "gwegewgewgewgwegewgewgwegewgwegwegw",
 | 
				
			||||||
 | 
					        "tags": [
 | 
				
			||||||
 | 
					            "cisco",
 | 
				
			||||||
 | 
					            "abc",
 | 
				
			||||||
 | 
					            "cs",
 | 
				
			||||||
 | 
					            "css"
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        "sku": "cisco102290",
 | 
				
			||||||
 | 
					        "location": ""
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "timestamp": "2025-08-12T03:21:28.051Z"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue