# Module

# Add Module

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 ✔️
name String ✔️
code String ✔️
description String ✔️
action 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/module/setList \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "items": {
        "$add": [
            {
                "name": "name",
                "code": "code",
                "description": "description",
                "action": "action"
            }
        ]
    }
  }'

# Update Module

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 ✔️
name String ✔️
code String ✔️
description String ✔️
action String ✔️
updatedBy Number get in token payload ✔️

# Response

{
  "status": true,
  "items": {
    "$rltAdd": [],
    "$rltUpdate": [
      {
        ...<data>
      }
    ],
    "$rltRemove": [],
    "$rltDelete": []
  }
}
curl -X POST http://localhost:3000/module/setList \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "items": {
        "$update": [
            {
                "id": 1,
                "name": "name",
                "code": "code",
                "description": "description",
                "action": "action"
            }
        ]
    }
  }'

# Delete Modules

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

# Remove Modules

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

# Get List Modules

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

# Endpoint

# Parameters

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

# Response

{
  "status": true,
  "message": "success",
  "totalRows": 30,
  "rows": [
    {
      "id": 103,
      "name": "Settings",
      "code": "settings",
      "deleted": false,
      "description": null,
      "action": "add|edit|delete|read",
      "createdBy": 1,
      "updatedBy": 1,
      "createdAt": "2021-09-14T09:26:37.926Z",
      "updatedAt": "2021-09-14T09:26:37.926Z"
    },
    {
        ...<data>
    }
  ]
}
curl -X POST http://localhost:3000/module/getListPaging \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "name": "name"
  }'