Customer

Endpoints for managing customer information.

'/customers'

POST

async create(
    @param.query.string('fileTransfer', {required: false}) fileTransfer: string,
    @requestBody({
      content: {
        'application/json': {
          schema: {
            type: 'object',
          },
        },
      },
    })
    customer: DTO<Customer & User & Address>,
  ): Promise<Customer>

Auth: No

Creates a new customer. This also sends a verification email to the user's email prompting them to verify their account.

There is a special case where the user uploaded a file without an account, then was prompted to sign up. We remember the file uploaded so it gets uploaded with account creation. This is done by uploading the file to the guest account temporarily then transferring ownership to the current acount.

GET

async find(
    @param.filter(Customer) filter?: Filter<Customer>,
  ): Promise<Customer[]>

Auth: Yes RBAC: Admin

Searches for customers. In general, only admins should be able to see customer information.

'/customers/{id}'

GET

async findById(
    @param.path.string('id') id: string,
    @param.filter(Customer, { exclude: 'where' })
    filter?: FilterExcludingWhere<Customer>,
  ): Promise<Customer>

Auth: Yes RBAC: Admin, Customer (owner)

Searches for a customer by ID.

DEL

async deleteById(@param.path.number('string') id: string): Promise<void>

Auth: Yes RBAC: Admin, Customer (owner)

Deletes a customer.

PATCH

async updateById(
    @param.path.string('id') id: string,
    @requestBody({
      content: {
        'application/json': {
          schema: getModelSchemaRef(Customer, { partial: true }),
        },
      },
    })
    customer: Customer,
  ): Promise<void>

Auth: Yes

Updates a customer's information. A customer should be able to change their information but not others.

Last updated