# Page Contents

# Add Page Contents

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 ✔️
pageId Number ✔️
images String ✔️
videos String ✔️
order String ✔️
title String ✔️
url String ✔️
host String ✔️
content String ✔️
titleSeo String ✔️
descriptionSeo String ✔️
keywordSeo String ✔️
createdBy Number get in token payload ✔️
updatedBy Number get in token payload ✔️

# Response

{
  "status": true,
  "items": {
    "$rltAdd": [
        {
            ...<data>
        }
    ],
    "$rltUpdate": [],
    "$rltRemove": [],
    "$rltDelete": []
  }
}
curl -X POST http://localhost:3000/pageContent/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",
                "pageId": "pageId",
                "images":"images",
                "videos": "videos",
                "order": "order"
            }
        ]
    }
  }'

# Update Page Content

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 ✔️
pageId String ✔️
images String ✔️
videos String ✔️
order String ✔️
title String ✔️
url String ✔️
host String ✔️
content String ✔️
titleSeo String ✔️
descriptionSeo String ✔️
keywordSeo String ✔️
updatedBy Number get in token payload ✔️

# Response

{
  "status": true,
  "items": {
    "$rltAdd": [],
    "$rltUpdate": [
      {
        ...<data>
      }
    ],
    "$rltRemove": [],
    "$rltDelete": []
  }
}
curl -X POST http://localhost:3000/pageContent/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",
                "pageId": "pageId",
                "images":"images",
                "videos": "videos",
                "order": "order"
            }
        ]
    }
  }'

# Delete Page Contents

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/pageContent/setList \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "items": {
        "$delete": [
            {
                "id": 1
            }
        ]
    }
  }'

# Remove Page Contents

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/pageContent/setList \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "items": {
        "$remove": [
            {
                "id": 1
            }
        ]
    }
  }'

# Get List Page Contents

Sử dụng API này để lấy danh sách Page Contents

# Endpoint

# Parameters

Name Type Description Required
companyId Number get in token payload ✔️
name String

# Response

{
  "status": true,
  "message": "success",
  "totalRows": 30,
  "rows": [
    {
      "id": 84,
      "companyId": 1,
      "pageId": 21,
      "images": "PagesContents/1/1/schneider logo.jpg",
      "videos": "",
      "order": 1,
      "title": "Uư đãi cùng với Schneider",
      "url": "uu-dai-cung-voi-schneider",
      "host": "",
      "content": "<p>C&aacute;c d&ograve;ng sản phẩm Schneider được chiết khấu l&ecirc;n đến 30%</p>\n",
      "titleSeo": "Uư đãi cùng với Schneider",
      "descriptionSeo": "<p>Uư đ&atilde;i c&ugrave;ng với Schneider</p>\n",
      "keywordSeo": "Uư đãi cùng với Schneider",
      "createdBy": 1,
      "updatedBy": 1,
      "deleted": 0,
      "createdAt": "2021-09-15T04:58:57.000Z",
      "updatedAt": "2021-09-16T01:54:41.000Z"
    },
    {
        ...<data>
    }
  ]
}
curl -X POST http://localhost:3000/pageContent/getListPaging \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "name": "name"
  }'