Files
dashlibstorage/API.quote.md
seb 29099b2a16 feat(manifest): add externalNumber reference to quote/order/delivery
- Add `external_number NVARCHAR(100)` column to the `manifest` table.
- Thread `externalNumber` through manifestDoc and delivery SQL (list,
  header, create, update).
- Include `externalNumber` in shapeSummary and quote/order/delivery
  create/update/list/getById handlers (optional, clearable on update).
- Update README type definitions and regenerate API/schema docs.
2026-08-08 09:13:20 +02:00

149 lines
3.8 KiB
Markdown

# 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.externalNumber]` | `string` | An external (customer) reference number. |
| `[body.lines]` | `Array<object>` | The quote lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|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, externalNumber, 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, externalNumber: string|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, externalNumber, 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, externalNumber: string|null, date: string}>>` — The quotes.
**Example**
```js
const quotes = await store.quote.list(42);
// => [{ id, number, type, entityId, externalNumber, 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.externalNumber]` | `string` | The new external (customer) reference number. |
| `[patch.lines]` | `Array<object>` | The new quote lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|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: [...] }
```