63 lines
1.2 KiB
Markdown
63 lines
1.2 KiB
Markdown
# customergroup
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `customergroup.create`
|
|
|
|
*Source: `src/store/customergroup/create.js`*
|
|
|
|
Creates a new customer group for a company.
|
|
|
|
```js
|
|
const fn = create(pool);
|
|
const group = await fn(42, 1, { name: 'Wholesale' });
|
|
// => { id, name, sort }
|
|
```
|
|
|
|
## `customergroup.delete`
|
|
|
|
*Source: `src/store/customergroup/delete.js`*
|
|
|
|
Deletes a customer group for a company by its id.
|
|
|
|
```js
|
|
const fn = del(pool);
|
|
await fn(42, 1, 5);
|
|
```
|
|
|
|
## `customergroup.list`
|
|
|
|
*Source: `src/store/customergroup/list.js`*
|
|
|
|
Lists the customer groups of a company.
|
|
|
|
```js
|
|
const fn = list(pool);
|
|
const groups = await fn(42, 1);
|
|
// => [{ id, name, sort }]
|
|
```
|
|
|
|
## `customergroup.order`
|
|
|
|
*Source: `src/store/customergroup/order.js`*
|
|
|
|
Reorders the customer groups of a company.
|
|
|
|
```js
|
|
const fn = order(pool);
|
|
const result = await fn(42, 1, { customergroupIds: [3, 1, 2] });
|
|
// => { customergroupIds: [3, 1, 2] }
|
|
```
|
|
|
|
## `customergroup.update`
|
|
|
|
*Source: `src/store/customergroup/update.js`*
|
|
|
|
Updates the name of a customer group for a company.
|
|
|
|
```js
|
|
const fn = update(pool);
|
|
const group = await fn(42, 1, 5, { name: 'Retail' });
|
|
// => { id, name, sort }
|
|
```
|