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