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:
146
API.order.md
Normal file
146
API.order.md
Normal file
@@ -0,0 +1,146 @@
|
||||
# order
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `order.create`
|
||||
|
||||
*Source: `src/store/order/create.js`*
|
||||
|
||||
Creates a new order for the user's selected company with its lines.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `body` | `object` | The order input. |
|
||||
| `body.number` | `string` | The order number. |
|
||||
| `body.date` | `string` | The order date. |
|
||||
| `[body.entityId]` | `number` | The id of the customer entity. |
|
||||
| `[body.lines]` | `Array<object>` | The order lines. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, number: string, type: string, entityId: number|null, date: string, lines: Array<object>}>` — The created order.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the order is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const order = await store.order.create(42, { number: 'B-2026-001', date: '2026-09-15', entityId: 12, lines: [...] });
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
|
||||
## `order.delete`
|
||||
|
||||
*Source: `src/store/order/delete.js`*
|
||||
|
||||
Deletes an order 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 order to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the order is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.order.delete(42, 5);
|
||||
```
|
||||
|
||||
## `order.getById`
|
||||
|
||||
*Source: `src/store/order/getById.js`*
|
||||
|
||||
Returns a single order 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 order. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, number: string, type: string, entityId: number|null, date: string, lines: Array<object>}>` — The order with its lines.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the order is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const order = await store.order.getById(42, 5);
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
|
||||
## `order.list`
|
||||
|
||||
*Source: `src/store/order/list.js`*
|
||||
|
||||
Lists the orders of the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, number: string, type: string, entityId: number|null, date: string}>>` — The orders.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const orders = await store.order.list(42);
|
||||
// => [{ id, number, type, entityId, date }]
|
||||
```
|
||||
|
||||
## `order.update`
|
||||
|
||||
*Source: `src/store/order/update.js`*
|
||||
|
||||
Updates an order's header and/or lines.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The id of the order to update. |
|
||||
| `patch` | `object` | The update patch. |
|
||||
| `[patch.number]` | `string` | The new order number. |
|
||||
| `[patch.date]` | `string` | The new order date. |
|
||||
| `[patch.entityId]` | `number` | The new customer entity id. |
|
||||
| `[patch.lines]` | `Array<object>` | The new order lines. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, number: string, type: string, entityId: number|null, date: string, lines: Array<object>}>` — The updated order.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the order is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const order = await store.order.update(42, 5, { number: 'B-2026-002', lines: [...] });
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
Reference in New Issue
Block a user