- Rewrite JSDoc across all store methods to document the actual async methods (real params, returns, throws) instead of the internal wrappers - Split quote/order into individual module files backed by shared manifestDoc helpers; remove the createStore factory and thin wrappers - Deduplicate manifest line helpers into src/store/manifestLines.js - Extend generate-api-doc.js to render parameter/return/throws types and emit per-namespace API.<module>.md files with an API.md index - Regenerate all API docs
142 lines
3.1 KiB
Markdown
142 lines
3.1 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 the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `input` | `object` | The customer group input. |
|
|
| `input.name` | `string` | The customer group name (must not be a reserved name). |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, name: string, sort: number}>` — The created customer group.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the name is empty or reserved.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const group = await store.customergroup.create(42, { name: 'Wholesale' });
|
|
// => { id, name, sort }
|
|
```
|
|
|
|
## `customergroup.delete`
|
|
|
|
*Source: `src/store/customergroup/delete.js`*
|
|
|
|
Deletes a customer group for the user's selected company by its id.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The id of the customer group to delete. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the customer group is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
await store.customergroup.delete(42, 5);
|
|
```
|
|
|
|
## `customergroup.list`
|
|
|
|
*Source: `src/store/customergroup/list.js`*
|
|
|
|
Lists the customer groups of the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<{id: number, name: string, sort: number}>>` — The customer groups.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const groups = await store.customergroup.list(42);
|
|
// => [{ id, name, sort }]
|
|
```
|
|
|
|
## `customergroup.order`
|
|
|
|
*Source: `src/store/customergroup/order.js`*
|
|
|
|
Reorders the customer groups of the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `input` | `object` | The reorder input. |
|
|
| `input.customergroupIds` | `Array<number>` | The customer group ids in their new order. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{customergroupIds: Array<number>}>` — The applied order.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the order is invalid.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const result = await store.customergroup.order(42, { customergroupIds: [3, 1, 2] });
|
|
// => { customergroupIds: [3, 1, 2] }
|
|
```
|
|
|
|
## `customergroup.update`
|
|
|
|
*Source: `src/store/customergroup/update.js`*
|
|
|
|
Updates the name of a customer group for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The id of the customer group to update. |
|
|
| `input` | `object` | The update input. |
|
|
| `input.name` | `string` | The new customer group name. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, name: string, sort: number}>` — The updated customer group.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the customer group is not found or the name is empty.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const group = await store.customergroup.update(42, 5, { name: 'Retail' });
|
|
// => { id, name, sort }
|
|
```
|