# Pages
# Add Pages
Sử dụng API này để thêm bản ghi mới
# Endpoint
# Parameters
Name | Type | Description | Required |
---|---|---|---|
companyId | Number | get in token payload | ✔️ |
title | String | ✔️ | |
url | String | ✔️ | |
host | String | ✔️ | |
content | String | ✔️ | |
titleSeo | String | ✔️ | |
descriptionSeo | String | ✔️ | |
keywordSeo | String | ✔️ | |
schema | String | ✔️ | |
banner | String | ✔️ | |
productList | String | parse Object to String | ✔️ |
createdBy | Number | get in token payload | ✔️ |
updatedBy | Number | get in token payload | ✔️ |
# Note
Các params trong mỗi thành phần của mảng có trong cột productList sau khi parse to Object
Categories
Name | Type | Description | Required |
---|---|---|---|
categoryIds | Array | ➖ |
Products
Name | Type | Description | Required |
---|---|---|---|
products | Array | ➖ |
Các params trong mỗi thành phần của mảng products
Name | Type | Description | Required |
---|---|---|---|
productName | String | ✔️ | |
productImg | String | ✔️ | |
productId | String | ✔️ | |
productSlug | String | ✔️ |
# Response
{
"status": true,
"items": {
"$rltAdd": [
{
...<data>
}
],
"$rltUpdate": [],
"$rltRemove": [],
"$rltDelete": []
}
}
curl -X POST http://localhost:3000/newsTag/setList \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
--data '{
"items": {
"$add": [
{
"title": "title",
"url": "url",
"host": "host",
"content": "content",
"titleSeo": "titleSeo",
"descriptionSeo": "descriptionSeo",
"keywordSeo": "keywordSeo",
"schema": "schema",
"banner":"banner",
"productList": "productList"
}
]
}
}'
# Update Page
Sử dụng API này để cập nhật nội dung
# Endpoint
# Parameters
Name | Type | Description | Required |
---|---|---|---|
id | Number | ✔️ | |
companyId | Number | get in token payload | ✔️ |
title | String | ✔️ | |
url | String | ✔️ | |
host | String | ✔️ | |
content | String | ✔️ | |
titleSeo | String | ✔️ | |
descriptionSeo | String | ✔️ | |
keywordSeo | String | ✔️ | |
schema | String | ✔️ | |
banner | String | ✔️ | |
productList | String | parse Object to String | ✔️ |
updatedBy | Number | get in token payload | ✔️ |
# Response
{
"status": true,
"items": {
"$rltAdd": [],
"$rltUpdate": [
{
...<data>
}
],
"$rltRemove": [],
"$rltDelete": []
}
}
curl -X POST http://localhost:3000/page/setList \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
--data '{
"items": {
"$update": [
{
"id": 1,
"title": "title",
"url": "url",
"host": "host",
"content": "content",
"titleSeo": "titleSeo",
"descriptionSeo": "descriptionSeo",
"keywordSeo": "keywordSeo",
"schema": "schema",
"banner":"banner",
"productList": "productList"
}
]
}
}'
# Delete Page
Sử dụng API này để xóa bản ghi trên giao diện
# Endpoint
# Parameters
Name | Type | Description | Required |
---|---|---|---|
id | Number | ✔️ |
# Response
{
"status": true,
"items": {
"$rltAdd": [],
"$rltUpdate": [],
"$rltRemove": [],
"$rltDelete": [
{
...<data>
}
]
}
}
curl -X POST http://localhost:3000/page/setList \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
--data '{
"items": {
"$delete": [
{
"id": 1
}
]
}
}'
# Remove Page
Sử dụng API này để xóa bản ghi khỏi database
# Endpoint
# Parameters
Name | Type | Description | Required |
---|---|---|---|
id | Number | ✔️ |
# Response
{
"status": true,
"items": {
"$rltAdd": [],
"$rltUpdate": [],
"$rltRemove": [
{
...<data>
}
],
"$rltDelete": []
}
}
curl -X POST http://localhost:3000/page/setList \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
--data '{
"items": {
"$remove": [
{
"id": 1
}
]
}
}'
# Get List Page
Sử dụng API này để lấy danh sách Page
# Endpoint
# Parameters
Name | Type | Description | Required |
---|---|---|---|
companyId | Number | get in token payload | ✔️ |
name | String | ➖ |
# Response
{
"status": true,
"message": "success",
"totalRows": 30,
"rows": [
{
"id": 106,
"companyId": 1,
"title": "Uư đãi cùng với Schneider",
"url": "uu-dai-cung-voi-schneider",
"host": "",
"content": "<p>Schneider Thương hiệu uy tín hàng đầu Châu Âu</p>\n",
"titleSeo": "Uư đãi cùng với Schneider",
"descriptionSeo": "<p>Uư đãi cùng với Schneider</p>\n",
"keywordSeo": "Uư đãi cùng với Schneider",
"schema": "",
"banner": "Page/1/1/smartfactory_banner-IC-2400x706.jpg",
"productList": "{\"categoryIds\":[1166,1167]}",
"createdBy": 1,
"updatedBy": 1,
"deleted": 0,
"createdAt": "2021-09-15T04:57:26.000Z",
"updatedAt": "2021-09-16T01:53:15.000Z"
},
{
...<data>
}
]
}
curl -X POST http://localhost:3000/page/getListPaging \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
--data '{
"name": "name"
}'