# I. Sản phẩm (AUTH)
## 1/ API xóa sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-product/delete/:id
- Request: EMPTY
- Body:
>{
id : number
}
- AUTH : REQUIRE
- Request sample URL: https://familystore.herokuapp.com/api/auth-product/delete/5
- ### Response sample:
>{
"statusCode": 0
}
## 2/ API Sửa thông tin sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-product/update/:id
- Request: EMPTY
> Body: {
prodName : String,
prodCategoryID : number,
prodAmount: number,
prodPrice : number,
prodDescription : String
}
- AUTH : REQUIRE
- Request sample URL: https://familystore.herokuapp.com/api/auth-product/update/28
- ### Sample request body:
>{
"prodName":"test",
"prodAmount" : 3000,
"prodDescription" : "test test"
}
- ### Response sample:
>{
"statusCode": 0
}
## 3/ API sửa ảnh sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-product/update-image/:id
- Request: EMPTY
- ### Sample Body:
{
image: file,
imageName: String
}
- Auth: REQUIRE
- Request sample URL: https://familystore.herokuapp.com/api/auth-product/update-image/28
- ### Sample request body:
>{
"imageName":"http://res.cloudinary.com/dhbc009wq/image/upload/v1629037972/ddrcywtxvpln335jq5me.png,http://res.cloudinary.com/dhbc009wq/image/upload/v1629037969/aqvcfil3sdwewddmgunp.png
",
"image" : file image
}
- ### Response sample:
>{
"statusCode": 0
}
## 4/ API thêm sản phẩm mới
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-product/add
- Request: FORM REQUEST
- ### Sample Body:
>{
prodName : String,
prodCategoryID : number,
prodAmount: number,
prodPrice : number,
prodDescription : String,
image: file,
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/auth-product/add
- ### Sample request body:
>{
"prodName" : "Test",
"prodAmount": 999,
"prodPrice" : 1000,
"prodDescription" : "Khá",
"image": file uploaded image,
"prodCategoryID": 1
}
- ### Response sample:
>{
"statusCode": 0
}
# II. Sản phẩm (loggin not require )
## 1/ API lấy danh sách sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/product/list
- Request: EMPTY
- Body: {page : number, limit : number}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/product/list
- ### Sample body:
>{
"page" : 2,
"limit" : 10
}
- ### Response sample:
>
{
"numberOfPage": 7,
"listProduct": [
{
"prod_id": 28,
"prod_name": "123",
"prod_category_id": 4,
"prod_category_name": "avocado",
"prod_amount": 123,
"prod_description": "123",
"prod_created_date": "2021-08-17T00:00:00.000Z",
"prod_updated_date": null,
"prod_price": "123",
"images": [
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207213/j7embp2u83njfaydhvmq.jpg",
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207213/p6bpbyvhtbyumyqciasp.jpg",
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207213/uto4tz6vqqhp8sysfuck.jpg"
]
},
{
"prod_id": 27,
"prod_name": "Tuấn Anh",
"prod_category_id": 4,
"prod_category_name": "avocado",
"prod_amount": 1,
"prod_description": "Quá NgonQuá NgonQuá NgonQuá NgonQuá NgonQuá NgonQuá NgonQuá NgonQuá NgonQuá n",
"prod_created_date": "2021-08-17T00:00:00.000Z",
"prod_updated_date": "2021-08-17T00:00:00.000Z",
"prod_price": "1",
"images": [
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207087/yzholsfgqfrjqxdayvy5.jpg",
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207170/kenomdirgmozihragyen.jpg",
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207132/gohqifx8bdjuk2hcgv7c.jpg",
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629207170/zjpksdaiwldve3y82wiw.jpg"
]
}
],
"statusCode": 0
}
## 2/ API lấy chi tiết
>Method: GET
- URL: {familystore.herokuapp.com}/api/product/details/:id
- Request: EMPTY
- Body:
> empty
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/product/details/20
- ### Response sample:
>
"listProductDetail": {
"prod_id": 20,
"prod_name": "peach",
"prod_category_id": 9,
"prod_amount": 0,
"prod_created_date": "2021-08-16T00:00:00.000Z",
"prod_updated_date": "2021-08-17T00:00:00.000Z",
"prod_price": "0",
"prod_description": "Đào (danh pháp khoa học: Prunus persica) là một loài cây được trồng để lấy quả hay hoa. Nó là một loài cây sớm rụng lá, thân gỗ nhỏ, có thể cao tới 5–10 m. Lá của nó có hình mũi mác, dài 7–15 cm và rộng 2–3 cm. Hoa nở vào đầu mùa xuân, trước khi ra lá; hoa đơn hay có đôi, đường kính 2,5–3 cm, màu hồng với 5 cánh hoa. Quả đào cùng với quả của anh đào, mận, mơ là các loại quả hạch.Quả của nó có một hạt giống to được bao bọc trong một lớp vỏ gỗ cứng (gọi là \"hột\"), cùi thịt màu vàng hay ánh trắng, có mùi vị thơm ngon và lớp vỏ có lông tơ mềm như nhung.",
"prod_status": 1,
"prod_img": [
"http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629193672/lwpvf6kxf2qn0jmphbja.jpg"
]
},
"statusCode": 0
## 3/ API lấy danh sách sản phẩm đề nghị theo chuyên mục, sắp xếp theo tiêu chí lượt vote trung bình nhiều nhất
>Method: POST
- URL: {familystore.herokuapp.com}/api/product/list-suggestion
- Request: NO
- ### Sample Body:
>{
"catID" :number,
"page": number,
"limit":number
}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/product/list-suggestion
- ### Sample request body:
>{
"catID" :2,
"page": 1,
"limit":3
}
- ### Response sample:
>{
"numberOfPage": 1,
"listProduct": [],
"statusCode": 0
}
## 4/ API lấy danh sách sản phẩm bán chạy nhất
>Method: POST
- URL: {familystore.herokuapp.com}/api/product/list-best-sale
- Request: NO
- ### Sample Body:
>{
"page": number,
"limit": number
}
- AUTH : NO
- Request sample URL:
>{
"page": 1,
"limit": 10
}
- familystore.herokuapp.com/api/product/list-best-sale
- ### Sample request body:
>
{
"numberOfPage": 1,
"listProduct": [
{
"prod_id": 2,
"prod_name": "Bánh quế",
"prod_category_id": 1,
"prod_amount": 81,
"prod_description": "ngon",
"prod_created_date": "Invalid date",
"prod_updated_date": "22/08/2021",
"prod_price": "15000",
"quantity": "7",
"images": null
},
{
"prod_id": 4,
"prod_name": "Bánh gạo",
"prod_category_id": 1,
"prod_amount": 88,
"prod_description": "ngon, giòn",
"prod_created_date": "Invalid date",
"prod_updated_date": "22/08/2021",
"prod_price": "15000",
"quantity": "6",
"images": null
},
{
"prod_id": 40,
"prod_name": "44",
"prod_category_id": 8,
"prod_amount": 95,
"prod_description": "4",
"prod_created_date": "18/08/2021",
"prod_updated_date": "24/08/2021",
"prod_price": "4",
"quantity": "6",
"images": "http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629249562/rbb1xfc8e45miey4l7xa.jpg"
},
{
"prod_id": 38,
"prod_name": "2",
"prod_category_id": 58,
"prod_amount": 96,
"prod_description": "2",
"prod_created_date": "18/08/2021",
"prod_updated_date": "21/08/2021",
"prod_price": "2",
"quantity": "4",
"images": "http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629249399/skvmha5zqkerpjvysazc.jpg"
},
{
"prod_id": 39,
"prod_name": "3",
"prod_category_id": 61,
"prod_amount": 98,
"prod_description": "3",
"prod_created_date": "18/08/2021",
"prod_updated_date": "21/08/2021",
"prod_price": "3",
"quantity": "2",
"images": "http://res.cloudinary.com/gvlt-qlqtpm/image/upload/v1629249511/hck0nqydizo0ug787tlp.jpg"
}
],
"statusCode": 0
}
- ### Response sample:
## 5/ API lấy danh sách sản phẩm theo chuyên mục
>Method: POST
- URL: {familystore.herokuapp.com}/api/product/list-by-cat
- Request: NO
- ### Sample Body:
>{
"page": number,
"limit": number,
"catID": number
}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/product/list-by-cat
- ### Sample request body:
>{
"page": 1,
"limit":2,
"catID":1
}
- ### Response sample:
> {
"numberOfPage": 2,
"numberProduct": "4",
"listProduct": [
{
"prod_id": 2,
"prod_name": "Bánh quế",
"prod_category_id": 1,
"prod_amount": 81,
"prod_description": "ngon",
"prod_created_date": "Invalid date",
"prod_updated_date": "22/08/2021",
"prod_price": "15000",
"images": null
},
{
"prod_id": 5,
"prod_name": "Bánh bắp",
"prod_category_id": 1,
"prod_amount": 100,
"prod_description": "ngon gắp đôi",
"prod_created_date": "Invalid date",
"prod_updated_date": "Invalid date",
"prod_price": "11000",
"images": null
}
],
"statusCode": 0
}
## 6/ Search sản phẩm theo tên
>Method: POST
- URL: {familystore.herokuapp.com}/api/product/search
- Request: NO
- ### Sample Body:
>{
"page": number,
"limit": number,
"prodName": string
"sortBy": string, optional field, default is 'asc', chỉ cho phép 'asc' và 'desc'
"filter": string, optional field, default is 'prod_created_date', chỉ cho phép các string như bên dưới
}
//filter...
//-prod_name: sắp xếp theo tên sp
//-prod_amount: sắp theo số lượng
//-prod_created_date:sắp theo ngày tạo
//-prod_price:sắp theo giá
//sortBy...
//-'asc': tăng dần
//-'desc':giảm dần
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/product/search
- ### Sample request body:
>{{
"prodName": "Thịt",
"limit": 1,
"page": 1,
"sortBy": "asc",
"filter": "prod_price"
}
- ### Response sample:
>
{
"numberOfPage": 8,
"numberProduct": "8",
"listProduct": [
{
"prod_id": 64,
"prod_name": "Thịt nạc vai heo C.P khay 300g",
"prod_category_id": 113,
"prod_amount": 10,
"prod_description": "<b>Nạc vai heo của thương hiệu CP</b> được đóng gói và bảo quản theo những tiêu chuẩn nghiêm ngặt về vệ sinh và an toàn thực phẩm, đảm bảo về chất lượng, độ tươi và ngon của thực phẩm, xuất xứ rõ ràng. Thịt vai heo ít mỡ, mềm và mọng nước nên thường được chế biến thành thịt luộc, thịt kho tiêu,..<img src=\"https://cdn.tgdd.vn/Products/Images/8781/241258/bhx/nac-vai-heo-cp-khay-300g-202106021659342357.jpg\" alt=\"\"/><h3>Hướng dẫn sử dụng</h3> Nấu chính trước khi sử dụng. Một số món ăn ngon từ thịt vai heo như: Thịt heo chiên nước mắm kiểu Thái, thịt heo sốt cà, thịt heo kho nghệ, thịt chiên sả ớt,...<br/> <b>Lưu ý</b>: Sản phẩm nhận được có thể khác với hình ảnh về màu sắc và số lượng nhưng vẫn đảm bảo về mặt khối lượng và chất lượng.<h3>Hướng dẫn bảo quản</h3>Bảo quản ở nhiệt độ 0 - 4 độ C, thời hạn sử dụng 3 ngày\n",
"prod_created_date": "12/09/2021",
"prod_updated_date": "12/09/2021",
"prod_price": "45000",
"images": null
}
],
"statusCode": 0
}
# III. Comment
## 1/ API lấy danh sách comment theo sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/comment/list
- Request: NO
- ### Sample Body:
>{
"productID": number,
"page": number,
"limit": number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/comment/list
- ### Sample request body:
>{
"productID": 28,
"page" : 3,
"limit": 2
}
- ### Response sample:
>
{
"listComment": {
"numberOfUserComment": "1",
"numberOfComment": "4",
"numberOfPage": 2,
"avgStar": "3.50",
"numberOneStar": "1",
"numberTwoStars": "0",
"numberThreeStars": "0",
"numberFourStars": "2",
"numberFiveStars": "1",
"commentList": [
{
"review_id": 4,
"content": "Cmt 4",
"star": 1,
"user_id": 2,
"user_name": "nthedao2705@gmail.com",
"user_avatar": null,
"createdAt": "2021-08-24 19:39:57",
"updatedAt": "2021-08-24 19:39:57"
},
{
"review_id": 3,
"content": "Cmt 3",
"star": 5,
"user_id": 2,
"user_name": "nthedao2705@gmail.com",
"user_avatar": null,
"createdAt": "2021-08-24 19:39:49",
"updatedAt": "2021-08-24 19:39:49"
}
]
},
"statusCode": 0
}
## 2/ API lấy thêm một comment mới cho sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/comment/add
- Request: NO
- ### Sample Body:
>{
"billID": number,
"productID": number,
"content": string(length 2000, allow null),
"vote" : number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/comment/add
- ### Sample request body:
>{
"billID": number,
"productID": 28,
"content" : "Nội dung comment 5",
"vote" : 3
}
- ### Response sample:
> {
"cmtId": 1,
"statusCode": 0
}
## 3/ API lấy cập nhật một comment mới cho sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/comment/update
- Request: NO
- ### Sample Body:
>{
"productID": number,
"content": string,
"vote" : number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/comment/update
- ### Sample request body:
>{
"commentID" : 12,
"content" : "Nội dung comment mới 6",
"vote" : 5
}
- ### Response sample:
> {
"status" : 0
}
## 4/ API xóa một comment của sản phẩm
>Method: POST
- URL: {familystore.herokuapp.com}/api/comment/delete
- Request: NO
- ### Sample Body:
>{
"productID": number,
"content": string,
"vote" : number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/comment/add
- ### Sample request body:
>{
"commentID" : 13
}
- ### Response sample:
> {
"statusCode": 0
}
# IV. Các API về giỏ hàng
## 1/ Lấy danh sách giỏ hàng của user đang đăng nhập
>Method: GET
- URL: {familystore.herokuapp.com}/api/cart/list
- Request: NO
- ### Sample Body:
>{
"page": number,
"limit": number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/cart/list
- Request: NO
- ### Sample request body:
{
"page": 1,
"limit": 10
}
- ### Response sample:
>
{
"listCart": [
{
"prodId": 28,
"cartAmount": 1,
"cartPrice": "123"
},
{
"prodId": 33,
"cartAmount": 10,
"cartPrice": "123"
}
],
"totalAmount": 11,
"totalPrice": 1353,
"statusCode": 0
}
## 2/ Thêm sản phẩm vào giỏ hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/cart/add
- Request: NO
- ### Sample Body:
>{
"prodId": number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/cart/add
- Request: NO
- ### Sample request body:
>{
"prodId": 28
}
- ### Response sample:
> {
"cartId": 2,
"statusCode": 0
}
## 3/ Update số lượng
>Method: POST
- URL: {familystore.herokuapp.com}/api/cart/update-amount
- Request: NO
- ### Sample Body:
>{
"cartId" : number,
"cartAmount" : number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/cart/update-amount
- Request: NO
- ### Sample request body:
>{
"cartId" : 1,
"cartAmount" : 10
}
- ### Response sample:
> {
"cartId": 1,
"statusCode": 0
}
## 4/ Kiểm tra giá
>Method: POST
- URL: {familystore.herokuapp.com}/api/cart/check-price
- Request: NO
- ### Sample Body:
>
{
listProduct: [
{
prodId: number,
cartAmount: number
},
...
}
]
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/cart/check-price
- Request: NO
- ### Sample request body:
>
{
"listProduct": [
{
"prodId" : 28,
"cartAmount": 1
},
{
"prodId" : 28,
"cartAmount": 10
}
]
}
- ### Response sample:
>
{
"totalPrice": 1353,
"statusCode": 0
}
## 5/ Xóa giỏ hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/cart/delete
- Request: NO
- ### Sample Body:
>
{
"cartId" : number
}
- AUTH : REQUIRE
- Request sample URL: familystore.herokuapp.com/api/cart/delete
- Request: NO
- ### Sample request body:
>
{
"cartId": 2
}
- ### Response sample:
>
{
"statusCode": 0
}
# V. Category
## 1/ Lấy danh sách chuyên mục
>Method: GET
- URL: {familystore.herokuapp.com}/api/categories/list?limit=2&query=1
- Request: NO
- ### Sample Body:
>{}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/categories/list?limit=2&page=1
- Require query params :
>{
"limit": number,
"page" : number
}
- ### Sample Body:
>{}
- ### Sample request body:
>{}
- ### Response sample:
>
{
{
"totalPage": 6,
"paginationResult": [
{
"cateId": 1,
"cateName": "Dương đào@",
"subCategories": [
{
"cateId": 91,
"cateName": "123456789",
"createDate": "18-08-2021"
},
{
"cateId": 92,
"cateName": "1234567891",
"createDate": "18-08-2021"
},
{
"cateId": 96,
"cateName": "1231",
"createDate": "18-08-2021"
},
{
"cateId": 97,
"cateName": "demo",
"createDate": "18-08-2021"
},
{
"cateId": 98,
"cateName": "asdasdsa",
"createDate": "18-08-2021"
},
{
"cateId": 99,
"cateName": "asdsadsa",
"createDate": "18-08-2021"
},
{
"cateId": 70,
"cateName": "144",
"createDate": "17-08-2021"
},
{
"cateId": 49,
"cateName": "cherry",
"createDate": "17-08-2021"
}
]
},
{
"cateId": 2,
"cateName": "Category 2",
"subCategories": [
{
"cateId": 6,
"cateName": "cate_6",
"createDate": "15-08-2021"
},
{
"cateId": 7,
"cateName": "cate_7",
"createDate": "15-08-2021"
},
{
"cateId": 95,
"cateName": "cake",
"createDate": "18-08-2021"
},
{
"cateId": 43,
"cateName": "cherry",
"createDate": "17-08-2021"
},
{
"cateId": 45,
"cateName": "avocado",
"createDate": "17-08-2021"
},
{
"cateId": 4,
"cateName": "avocado",
"createDate": "15-08-2021"
}
]
}
],
"statusCode": 0
}
}
## 2/ Lấy danh sách cha
>Method: GET
- URL: {familystore.herokuapp.com}/api/categories/list-father?page=1&limit=5
- Request: NO
- ### Sample Body:
>{}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/categories/list-father?page=1&limit=5
- Require query params :
>{
"limit": number,
"page" : number
}
- ### Sample Body:
>{}
- ### Sample request body:
>{}
- ### Response sample:
>
{
"totalPage": 3,
"paginationResult": [
{
"cateId": 1,
"cateName": "Dương đào@",
"createDate": "01-01-2001"
},
{
"cateId": 2,
"cateName": "Category 2",
"createDate": "01-01-2001"
},
{
"cateId": 3,
"cateName": "Category 3",
"createDate": "01-01-2001"
},
{
"cateId": 56,
"cateName": "Cate Tuan Anh",
"createDate": "17-08-2021"
},
{
"cateId": 83,
"cateName": "12321",
"createDate": "18-08-2021"
}
],
"statusCode": 0
}
## 3/ Lấy danh sách con
>Method: POST
- URL: {familystore.herokuapp.com}/api/categories/list-child?page=1&limit=5
- Request: NO
- ### Sample Body:
>{}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/categories/list-child?page=1&limit=5
- Require query params :
>{
"limit": number,
"page" : number
}
- ### Sample Body:
>{
"cateFather" : 1
}
- ### Sample request body:
>{
"cateFather" : number
}
- ### Response sample:
>
{
"cateId": 1,
"cateName": "Dương đào@",
"createDate": "01-01-2001",
"totalPage": 2,
"subCategories": [
{
"cateId": 91,
"cateName": "123456789",
"createDate": "18-08-2021"
},
{
"cateId": 92,
"cateName": "1234567891",
"createDate": "18-08-2021"
},
{
"cateId": 96,
"cateName": "1231",
"createDate": "18-08-2021"
},
{
"cateId": 97,
"cateName": "demo",
"createDate": "18-08-2021"
},
{
"cateId": 98,
"cateName": "asdasdsa",
"createDate": "18-08-2021"
}
],
"statusCode": 0
}
## 4/ Lấy danh Sản Phẩm Cho Mỗi Category
>Method: GET
- URL: {familystore.herokuapp.com}/api/categories/product-with-cate
- Request: NO
- ### Sample Body:
>{}
- AUTH : NO
- Request sample URL: familystore.herokuapp.com/api/categories/product-with-cate
- ### Response sample:
>
{
"cateId": 1,
"cateName": "Dương đào@",
"information": [
{
"cateId": 91,
"cateName": "cate",
listProducts: [
{
prodId:,
prodName:,
prodAmount:,
prodPrice:,
prodDescription:,
prodImage:,
},
{
prodId:,
prodName:,
prodAmount:,
prodPrice:,
prodDescription:,
prodImage:,
}
]
},
{
"cateId": 92,
"cateName": "11231283",
listProducts: [
{
prodId:,
prodName:,
prodAmount:,
prodPrice:,
prodDescription:,
prodImage:,
},
{
prodId:,
prodName:,
prodAmount:,
prodPrice:,
prodDescription:,
prodImage:,
}
]
}
],
"statusCode": 0
}
# VI. Category (AUTH)
## 1/ Sửa chuyên mục
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-categories/update
- Request: NO
- ### Sample Body:
>{
"cateName": String,
"cateId": number,
"cateFather": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/auth-categories/update
- ### Sample request body:
>{
"cateName": "test",
"cateId": 2,
"cateFather": 7
}
- ### Response sample:
> {
"statusCode": 0
}
## 2/ Xóa chuyên mục
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-categories/update
- Request: NO
- ### Sample Body:
>{
"cateId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/auth-categories/delete
- ### Sample request body:
>{
"cateId": 2,
}
- ### Response sample:
> {
"statusCode": 0
}
## 3/ Thêm chuyên mục cha
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-categories/add-fathers
- Request: NO
- ### Sample Body:
>{
"cateName": string (length [1, 100])
}
- AUTH : YES
- Request sample URL: https://familystore.herokuapp.com/api/auth-categories/add-father
- ### Sample request body:
>{
"cateName":"Category father 1"
}
- ### Response sample:
> {
"statusCode": 0
}
## 4/ Thêm chuyên mục con
>Method: POST
- URL: {familystore.herokuapp.com}/api/auth-categories/add-fathers
- Request: NO
- ### Sample Body:
>{
"cateName":"Category father 1" (length [1, 100])
"cateFather": number
}
- AUTH : YES
- Request sample URL: https://familystore.herokuapp.com/api/auth-categories/add-child
- ### Sample request body:
>{
"cateName":"Category child 1"
"cateFather": 1
}
- ### Response sample:
> {
"statusCode": 0
}
# VII. Địa chỉ giao hàng
## 1/ Thêm city
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/add-city
- Request: NO
- ### Sample Body:
>{
"cityName": string
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/add-city
- ### Sample request body:
>{
"cityName": "TPHCM",
}
- ### Response sample:
> {
"statusCode": 0
}
## 2/ Thêm quận
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/add-district
- Request: NO
- ### Sample Body:
>{
"distName": string,
"cityId" : number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/add-district
- ### Sample request body:
>{
"cityId": 1,
"distName":"Quận 1",
"cityId" : 1
- ### Response sample:
> {
"statusCode": 0
}
## 3/ Thêm phường
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/add-ward
- Request: NO
- ### Sample Body:
>{
"cityId": number,
"distId": number,
"wardName": string,
"wardShipPrice": string // giá ship tới quận
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/add-ward
- ### Sample request body:
>{
"cityId": 1,
"distId": 1,
"wardId": 1,
"wardName": "phường 12",
"wardShipPrice": "3000"
}
- ### Response sample:
> {
"statusCode": 0
}
## 4/ Thêm địa chỉ vận chuyển
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/add-delivery
- Request: NO
- ### Sample Body:
>{
"cityId": number,
"distId": number,
"wardId": number,
"accId" : number,
"delDetailAddress": string // địa chỉ giao hàng tới
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/add-delivery
- ### Sample request body:
>{
"cityId": 1,
"distId": 1,
"wardId": 1,
"accId" : 2,
"delDetailAddress": "Dinh độc lập"
}
- ### Response sample:
> {
"statusCode": 0
}
## 5/ Lấy danh sách city
>Method: GET
- URL: {familystore.herokuapp.com}/api/delivery/list-cities
- Request: NO
- ### Sample Body: NO
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/list-cities
- ### Response sample:
> {
"listcities": [
{
"ci_id": 1,
"ci_name": "TPHCM",
"ci_created_date": "2021-08-21T17:00:00.000Z",
"ci_updated_date": null
}
],
"statuscode": 0
}
## 6/ Lấy danh sách quận
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/list-districts
- Request: NO
- ### Sample Body:
>{
"cityId": number,
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/list-districts
- ### Sample request body:
>{
"cityId": 1,
}
- ### Response sample:
>
{
"listDistricts": [
{
"dis_id": 1,
"dis_name": "Quận 1",
"dis_city_id": 1,
"dis_created_date": null,
"dis_updated_date": null
}
],
"statusCode": 0
}
## 7/ Lấy danh sách phường
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/list-ward
- Request: NO
- ### Sample Body:
>{
"cityId": number,
"districtId" : number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/list-ward
- ### Sample request body:
>{
"cityId": 1,
"districtId" : 1
}
- ### Response sample:
>
{
"listcities": [
{
"ward_id": 1,
"ward_name": "phường 12",
"ward_city_id": 1,
"ward_dis_id": 1,
"ward_created_date": "2021-08-21T17:00:00.000Z",
"ward_updated_date": null,
"ward_ship_price": "3000"
}
],
"statuscode": 0
}
## 8/ Lấy danh sách địa chỉ vận chuyển
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/list-deliveries
- Request: NO
- ### Sample Body:
>{
"accId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/list-deliveries
- ### Sample request body:
>{
"accId": 2
}
- ### Response sample:
>
{
"listDeliveries": [
{
"del_id": 1,
"del_detail_address": "Dinh độc lập",
"del_district_id": 1,
"del_city_id": 1,
"del_user_id": 2,
"del_status": 0,
"del_ward_id": 1,
"dis_id": 1,
"dis_name": "Quận 1",
"dis_city_id": 1,
"dis_created_date": null,
"dis_updated_date": null,
"ci_id": 1,
"ci_name": "TPHCM",
"ci_created_date": "2021-08-21T17:00:00.000Z",
"ci_updated_date": null
}
],
"statusCode": 0
}
## 9/ Update thành phố
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/update-city
- Request: NO
- ### Sample Body:
>{
"cityId": number,
"cityName": string
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/update-city
- ### Sample request body:
>{
"cityId": 1,
"cityName": "Hà nội"
}
- ### Response sample:
>
{
"statusCode": 0
}
## 10/ Update quận
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/update-district
- Request: NO
- ### Sample Body:
>{
"cityId": number,
"distId": number,
"distName": string
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/update-district
- ### Sample request body:
>{
"cityId": 1,
"distId": 2,
"distName": "Quận tân bình"
}
- ### Response sample:
>
{
"statusCode": 0
}
## 11/ Update phường
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/update-ward
- Request: NO
- ### Sample Body:
>{
"delId": number,
"wardId": number,
"delDetailAddress": "Hoàn kiếm, hải phòng"
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/update-ward
- ### Sample request body:
>{
"delId": 2,
"wardId": 2,
"delDetailAddress": "Hoàn kiếm, hải phòng"
}
- ### Response sample:
>
{
"statusCode": 0
}
## 12/ Update địa chỉ giao hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/update-delivery
- Request: NO
- ### Sample Body:
>{
"delId": number,
"wardId": number,
"delDetailAddress": string
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/update-delivery
- ### Sample request body:
>{
"delId": 2,
"wardId": 2,
"delDetailAddress": "Hoàn kiếm, hải phòng"
}
- ### Response sample:
>
{
"statusCode": 0
}
## 13/ Delete thành phố
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/delete-city
- Request: NO
- ### Sample Body:
>{
"cityId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/delete-city
- ### Sample request body:
>{
"cityId": 1
}
- ### Response sample:
>
{
"statusCode": 0
}
## 14/ Delete quận
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/delete-district
- Request: NO
- ### Sample Body:
>{
"wardId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/delete-district
- ### Sample request body:
>{
"distId": 2
}
- ### Response sample:
>
{
"statusCode": 0
}
## 15/ Delete phường
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/delete-ward
- Request: NO
- ### Sample Body:
>{
"wardId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/delete-ward
- ### Sample request body:
>{
"wardId": 2
}
- ### Response sample:
>
{
"statusCode": 0
}
## 16/ Delete địa chỉ giao hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/delivery/delete-delivery
- Request: NO
- ### Sample Body:
>{
"delId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/delivery/delete-delivery
- ### Sample request body:
>{
"delId": 2
}
- ### Response sample:
>
{
"statusCode": 0
}
# VIII. Đơn hàng
## 1/ Thêm đơn hàng mới
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/add
- Request: NO
- ### Sample Body:
>
{
"accAddress": string,
"priceShip": string,
"receiverName": string,
"receiverPhone": string,
"receiverNote": string,
"listProduct":[
{
"prodId": number,
"prodQuantity": number
}
]
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/add
- ### Sample request body:
>
{
"accAddress": "123 Nguyên Văn Cừ, Phường 10, Quận 5, TP.HCM",
"priceShip": "1000",
"receiverName": "Trần Văn Đan",
"receiverPhone": "0123456789",
"receiverNote": "Gọi khi giao",
"listProduct":[
{
"prodId": 40,
"prodQuantity" :1
},
{
"prodId": 38,
"prodQuantity" :2
},
{
"prodId": 39,
"prodQuantity" :2
}
]
}
- ### Response sample:
>
{
"statusCode": 0
}
## 2/ Hủy đơn hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/cancel-bill
- Request: NO
- ### Sample Body:
>{
"billId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/cancel-bill
- ### Sample request body:
>{
"billId": 10
}
- ### Response sample:
>
{
"statusCode": 0
}
## 3/ Chi tiết 1 đơn hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/details
- Request: NO
- ### Sample Body:
>{
"billId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/details
- ### Sample request body:
>{
"billId": 10
}
- ### Response sample:
>
{
"ListDetail": {
"billId": 10,
"accountID": 18,
"totalPrice": "76000",
"billQuantity": 5,
"billStatus": "delivered",
"priceShip": null,
"billAddress": "123 Nguyên Văn Cừ, Phường 10, Quận 5, TP.HCM",
"fullNameReceiver": "Lê Thanh Tí",
"phoneNumberReceiver": "0142563454",
"noteReceiver": "",
"createDate": "21/08/2021 00:00:00",
"expectedDate": "23/08/2021 00:00:00",
"billDetailList": [
{
"productID": 2,
"prodName": "Bánh quế",
"prodCategory": "Dương đào@",
"prodQuantity": 78,
"prodDescription": "ngon",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
},
{
"productID": 4,
"prodName": "Bánh gạo",
"prodCategory": "Dương đào@",
"prodQuantity": 86,
"prodDescription": "ngon, giòn",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
}
]
},
"statusCode": 0
}
## 4/ Lấy danh sách đơn hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/list/:filter
- Request: NO
- ### Sample Body:
>{
"page": number,
"limit": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/list
familystore.herokuapp.com/api/bill/list/all
familystore.herokuapp.com/api/bill/list/delivered
familystore.herokuapp.com/api/bill/list/shipping
familystore.herokuapp.com/api/bill/list/confirm
familystore.herokuapp.com/api/bill/list/cancel
- ### Sample request body:
>{
"page": 1
"limit": 2
}
- ### Response sample:
>
{
"billList": [
{
"billId": 9,
"accountID": 18,
"totalPrice": "76000",
"billQuantity": 5,
"priceShip": null,
"billStatus": "shipping",
"createDate": "21/08/2021 00:00:00",
"expectedDate": "23/08/2021 00:00:00",
"billDetailList": [
{
"productID": 2,
"prodName": "Bánh quế",
"prodCategory": "Dương đào@",
"prodQuantity": 78,
"prodDescription": "ngon",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
},
{
"productID": 4,
"prodName": "Bánh gạo",
"prodCategory": "Dương đào@",
"prodQuantity": 86,
"prodDescription": "ngon, giòn",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
}
]
},
{
"billId": 11,
"accountID": 18,
"totalPrice": "46000",
"billQuantity": 3,
"priceShip": null,
"billStatus": "shipping",
"createDate": "21/08/2021 00:00:00",
"expectedDate": "23/08/2021 00:00:00",
"billDetailList": [
{
"productID": 2,
"prodName": "Bánh quế",
"prodCategory": "Dương đào@",
"prodQuantity": 78,
"prodDescription": "ngon",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
},
{
"productID": 4,
"prodName": "Bánh gạo",
"prodCategory": "Dương đào@",
"prodQuantity": 86,
"prodDescription": "ngon, giòn",
"prodCreatedDate": "Invalid date",
"prodUpdatedDate": "21/08/2021",
"prodPrice": "15000",
"images": null
}
]
}
],
"statusCode": 0
}
## 5/ Xác nhận đơn hàng
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/confirm-bill
- Request: NO
- ### Sample Body:
>{
"billId": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/confirm-bill
- ### Sample request body:
>{
"billId": 10
}
- ### Response sample:
>
{
"statusCode": 0
}
## 6/ Update status
>Method: POST
- URL: {familystore.herokuapp.com}/api/bill/update-status
- Request: NO
- ### Sample Body:
>{
"billId": number,
"status" : //có 4 giá trị "shipping", "delivered", "cancel", "confirm"
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/bill/update-status
- ### Sample request body:
>{
"billId":60,
"status":"shipping"
}
- ### Response sample:
>
{
"statusCode": 0
}
# IX. Account
## 1/Get list
>Method: GET
- URL: {familystore.herokuapp.com}/api/account/list?page=1&limit=1
- Request: NO
- ### Sample QUERY:
>{
"page": number,
"limit": number
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/list?page=2&limit=3
- ### Sample request QUERY:
>{
"page": 1
"limit": 2
}
- ### Response sample:
{
"totalPage": 13,
"listAccounts": [
{
"accId": 6,
"accEmail": "asd@gmail.com",
"accPhoneNumber": "84121231233",
"accFullName": "khalasdas",
"accAvatar": '',
"accStatus": 1,
"accRole": "Admin"
},
{
"accId": 7,
"accEmail": "khong@gmail.com",
"accPhoneNumber": "08887727272",
"accFullName": "asdasdas",
"accAvatar": '',
"accStatus": 1,
"accRole": "Admin"
},
{
"accId": 8,
"accEmail": "tem@gmail.com",
"accPhoneNumber": "84019123123",
"accFullName": "temp",
"accAvatar": '',
"accStatus": 1,
"accRole": "Admin"
}
],
"statusCode": 0
}
## 2/Update account
- URL: {familystore.herokuapp.com}/api/account/update
- Request: FORM DATA
- ### Sample FORM DATA:
>{
accId: number with string type
accEmail:String maxlength 100
accPhoneNumber: String maxlength 15
accFullName: Maxlength 50,
accOldPassword: string,
accNewPassword: string,
accConfirmPassword: string
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/update
- ### Sample request FORM DATA:
>{
accId: 9 (optional)
accEmail: "nt11061999@gmail.com" (optional)
accPhoneNumber: '0123456789' (optional)
accFullName: 'hashirama' (optional)
}
- ### Response sample:
>{
"statusCode": 0
}
## 3/Delete account
>Method: POST
- URL: {familystore.herokuapp.com}/api/account/delete/:accountID
- Request: NO
- ### Sample body:
>NO
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/delete/10
- ### Sample request body:
>NO
- ### Response sample:
>
{
"statusCode": 0
}
## 4/Detail
>Method: GET
- URL: {familystore.herokuapp.com}/api/account/details/:number
- Request: NO
- ### Sample body:
>NO
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/details/10
- ### Sample request body:
>NO
- ### Response sample:
>
{
"account": {
"accEmail": "gadoyew739@aline9.com",
"accFullName": "asdasd",
"accPhoneNumber": "8412123123123",
"accAvatar": null,
"deliveryAddress": []
},
"statusCode": 0
}
## 5/Update ROLE
>Method: POST
- URL: {familystore.herokuapp.com}/api/account/update-role
- Request: NO
- ### Sample body:
>{
"accId" : number with string type, (require)
"accRole": string maxlength 5, accept only "ADM" or "USER" (require)
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/update-role
- ### Sample request body:
>{
"accId" : 9,
"accRole": "ADM"
}
- ### Response sample:
>{
"statusCode": 0
}
## 6/Add Or Update Avatar
>Method: POST
- URL: {familystore.herokuapp.com}/api/account/update-avatar
- Request: FORM DATA
- ### Sample FORM DATA:
>{
accId: number, (require)
image : image file (require)
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/update-avatar
- ### Sample request FORM DATA:
>{
accId : 9 (optional)
image : image file (require)
}
- ### Response sample:
>{
"statusCode": 0
}
## 7/Delete Avatar
>Method: POST
- URL: {familystore.herokuapp.com}/api/account/delete-avatar
- Request: FORM DATA
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/delete-avatar
- - ### Sample FORM DATA:
>{
accId: number with string type
}
- ### Sample request FORM DATA:
>{
"accId" : "9"
}
- ### Response sample:
>{
"statusCode": 0
}
## 8/Update Status
>Method: POST
- URL: {familystore.herokuapp.com}/api/account/update-status
- Request: NO
- ### Sample body:
>{
"accId" : number, (require)
"accStatus": number (require)
}
- AUTH : YES
- Request sample URL: familystore.herokuapp.com/api/account/update-status
- ### Sample request body:
>{
"accId" : 9,
"accStatus": 1
}
- ### Response sample:
>{
"statusCode": 0
}