Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- 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
This commit is contained in:
@@ -6,11 +6,28 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
*Source: `src/store/customergroup/create.js`*
|
||||
|
||||
Creates a new customer group for a company.
|
||||
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 fn = create(pool);
|
||||
const group = await fn(42, { name: 'Wholesale' });
|
||||
const group = await store.customergroup.create(42, { name: 'Wholesale' });
|
||||
// => { id, name, sort }
|
||||
```
|
||||
|
||||
@@ -18,22 +35,49 @@ const group = await fn(42, { name: 'Wholesale' });
|
||||
|
||||
*Source: `src/store/customergroup/delete.js`*
|
||||
|
||||
Deletes a customer group for a company by its id.
|
||||
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
|
||||
const fn = del(pool);
|
||||
await fn(42, 5);
|
||||
await store.customergroup.delete(42, 5);
|
||||
```
|
||||
|
||||
## `customergroup.list`
|
||||
|
||||
*Source: `src/store/customergroup/list.js`*
|
||||
|
||||
Lists the customer groups of a company.
|
||||
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 fn = list(pool);
|
||||
const groups = await fn(42);
|
||||
const groups = await store.customergroup.list(42);
|
||||
// => [{ id, name, sort }]
|
||||
```
|
||||
|
||||
@@ -41,11 +85,28 @@ const groups = await fn(42);
|
||||
|
||||
*Source: `src/store/customergroup/order.js`*
|
||||
|
||||
Reorders the customer groups of a company.
|
||||
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 fn = order(pool);
|
||||
const result = await fn(42, { customergroupIds: [3, 1, 2] });
|
||||
const result = await store.customergroup.order(42, { customergroupIds: [3, 1, 2] });
|
||||
// => { customergroupIds: [3, 1, 2] }
|
||||
```
|
||||
|
||||
@@ -53,10 +114,28 @@ const result = await fn(42, { customergroupIds: [3, 1, 2] });
|
||||
|
||||
*Source: `src/store/customergroup/update.js`*
|
||||
|
||||
Updates the name of a customer group for a company.
|
||||
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 fn = update(pool);
|
||||
const group = await fn(42, 5, { name: 'Retail' });
|
||||
const group = await store.customergroup.update(42, 5, { name: 'Retail' });
|
||||
// => { id, name, sort }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user