# Sổ địa chỉ - Doanh nghiệp - Sửa địa chỉ

# Get All Address of Customer - Done

Sử dụng APi này để lấy tất cả danh sách địa chỉ của khách hàng, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required

# Response

{
  "status": true,
  "messageCode": "",
  "messageName": "",
  "data": {
    "totalCnt": 2,
    "items": [
      {
        "id": 1,
        "customerId": 1,
        "companyName": "EI",
        "receiverName": "Xinat1",
        "email": "xinat@gmail.com",
        "phone": "123456789",
        "province": "1",
        "district": "1",
        "ward": "1",
        "createdAt": "2021-07-14T17:00:00.000Z",
        "updatedAt": "2021-07-14T17:00:00.000Z",
        "createdBy": 1,
        "updatedBy": 1,
        "deleted": false
      },
      {
        "id": 2,
        "customerId": 1,
        "companyName": "EI",
        "receiverName": "Xinat2",
        "email": "xinat@gmail.com",
        "phone": "123456789",
        "province": "1",
        "district": "1",
        "ward": "1",
        "createdAt": "2021-07-14T17:00:00.000Z",
        "updatedAt": "2021-07-14T17:00:00.000Z",
        "createdBy": 1,
        "updatedBy": 1,
        "deleted": false
      }
    ]
  }
}
curl -X POST http://localhost:3000/customerAddress/ei/getList \
  -H 'Content-Type: application/json' \
  --data '{
    "customerId": "1"
  }'

# Add New Address of Customer - Done

Sử dụng API này để khách hàng thêm địa chỉ khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
receiverName String
companyName String
email String ✔️
phone String ✔️
province Number
district Number
ward Number

# Response

{
    "status": true,
    "messageCode": "",
    "messageName": "",
    "data": {
        "items": {
            "createdAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "updatedAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "deleted": false,
            "id": 2,
            "customerId": 1,
            "companyName": "EI",
            "receiverName": "Example Name",
            "email": "example@gmail.com",
            "phone": "0971234567",
            "province": 1,
            "district": 1,
            "ward": 1,
            "createdBy": 1
        }
    }
}
curl -X POST http://localhost:3000/customerAddress/ei/add \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "companyName":"EI",
    "receiverName":"Example Name",
    "email":"example@gmail.com",
    "phone":"0971234567",
    "province":"1",
    "district":"1",
    "ward":"1"
  }'

# Edit Address of Customer - Done

Sử dụng API này để khách hàng chỉnh sửa thông tin địa chỉ, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
addressId Number ✔️
receiverName String
companyName String
email String
phone String
province Number
district Number
ward Number

# Response

{
    "status": true,
    "messageCode": "",
    "messageName": "",
    "data": {
        "items": {
            "id": 1,
            "customerId": 1,
            "companyName": "EI Cty",
            "receiverName": "Example Name",
            "email": "example@gmail.com",
            "phone": "0971234567",
            "province": 2,
            "district": 2,
            "ward": 2,
            "createdAt": "2021-07-16T06:45:46.821Z",
            "updatedAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "createdBy": 1,
            "updatedBy": 1,
            "deleted": false
        }
    }
}
curl -X POST http://localhost:3000/customerAddress/ei/update \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "addressId":"1",
    "companyName":"EI",
    "receiverName":"Example Name",
    "email":"example@gmail.com",
    "phone":"0971234567",
    "province":"1",
    "district":"1",
    "ward":"1"
  }'

# Delete Address of Customer - Done

Sử dụng API này để khách hàng xóa thông tin địa chỉ, khi khách hàng đã đăng nhập

# Endpoint

# Parameters

Name Type Description Required
addressId Number ✔️

# Response

{
    "status": true,
    "messageCode": "",
    "messageName": "",
    "data": {
        "items": {
            "id": 1,
            "customerId": 1,
            "companyName": "EI Cty",
            "receiverName": "Example Name",
            "email": "example@gmail.com",
            "phone": "0971234567",
            "province": "2",
            "district": "2",
            "ward": "2",
            "createdAt": "2021-07-16T06:45:46.821Z",
            "updatedAt": {
                "val": "CURRENT_TIMESTAMP(3)"
            },
            "createdBy": 1,
            "updatedBy": 1,
            "deleted": true
        }
    }
}
curl -X POST http://localhost:3000/customerAddress/ei/delete \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <const name="MOCK_TOKEN" />' \
  --data '{
    "addressId":"1"
  }'