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/supplier/create.js`*
|
||||
|
||||
Creates a new supplier for a company, recording history.
|
||||
Creates a new supplier for the user's selected company, recording history.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The supplier input. |
|
||||
| `input.name` | `string` | The supplier name. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The created supplier.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the name is empty.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = create(pool);
|
||||
const supplier = await fn(42, { name: 'Acme Supplies' });
|
||||
const supplier = await store.supplier.create(42, { name: 'Acme Supplies' });
|
||||
// => { id, name, createdAt, updatedAt }
|
||||
```
|
||||
|
||||
@@ -18,22 +35,49 @@ const supplier = await fn(42, { name: 'Acme Supplies' });
|
||||
|
||||
*Source: `src/store/supplier/delete.js`*
|
||||
|
||||
Deletes a supplier by its id within a company.
|
||||
Deletes a supplier by its id within the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The id of the supplier to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the supplier is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 5);
|
||||
await store.supplier.delete(42, 5);
|
||||
```
|
||||
|
||||
## `supplier.list`
|
||||
|
||||
*Source: `src/store/supplier/list.js`*
|
||||
|
||||
Lists the suppliers of a company.
|
||||
Lists the suppliers 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, createdAt: string, updatedAt: string}>>` — The suppliers.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const suppliers = await fn(42);
|
||||
const suppliers = await store.supplier.list(42);
|
||||
// => [{ id, name, createdAt, updatedAt }]
|
||||
```
|
||||
|
||||
@@ -43,8 +87,26 @@ const suppliers = await fn(42);
|
||||
|
||||
Updates the name of a supplier, recording history.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The id of the supplier to update. |
|
||||
| `input` | `object` | The update input. |
|
||||
| `input.name` | `string` | The new supplier name. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The updated supplier.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the supplier is not found or the name is empty.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = update(pool);
|
||||
const supplier = await fn(42, 5, { name: 'Acme GmbH' });
|
||||
const supplier = await store.supplier.update(42, 5, { name: 'Acme GmbH' });
|
||||
// => { id, name, createdAt, updatedAt }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user