Customer Address

Endpoints to manage customer address information.

'/customers/{id}/addresses'

GET

async find(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @param.query.object('filter') filter?: Filter<Address>,
  ): Promise<Address[]>

Auth: Yes RBAC: Admin, Customer (owner)

Searches for addresses for a given customer.

POST

async create(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Address, {
            title: 'NewAddressInCustomer',
            exclude: ['id'],
            optional: ['userId']
          }),
        },
      },
    }) address: Omit<Address, 'id'>,
  ): Promise<Address>

Auth: Yes RBAC: Admin, Customer (owner)

Adds a new address for a given customer.

DEL

async delete(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @param.query.object('where', getWhereSchemaFor(Address)) where?: Where<Address>,
  ): Promise<Count>

Auth: Yes RBAC: Admin, Customer (owner)

Deletes an address for a given customer.

'/customers/{id}/addresses/{addressId}/default'

POST

async setDefaultAddress(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @param.path.string('addressId') addressId: typeof Address.prototype.id,
  ): Promise<Address>

Auth: Yes RBAC: Admin, Customer (owner)

Get the default address for a customer.

'/customers/{id}/addresses/{addressId}'

GET

async findById(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @param.path.number('addressId') addressId: typeof Address.prototype.id,
  ): Promise<Address>

Auth: Yes RBAC: Admin, Customer (owner)

Get a specific address for a given customer.

PATCH

async patch(
    @param.path.string('id') id: typeof Customer.prototype.id,
    @param.path.number('addressId') addressId: typeof Address.prototype.id,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Address, { partial: true }),
        },
      },
    })
    address: Partial<Address>,
  ): Promise<Count>

Auth: Yes RBAC: Admin, Customer (owner)

Update a specific address for a given customer.

Last updated