4.4 KiB
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<{sku?: string, name?: string, pu?: number, amount: number, net: number, rebate?: number, taxrate: number, comment?: string | null}>` |
Returns
Promise<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|null, date: string, lines: Array<{id: number, sku: string|null, name: string|null, pu: number, amount: number, net: number, rebate: number, taxrate: number, comment: string|null}>}> — The created quote.
Throws
Error — If the quote is invalid.
Example
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
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<{id: number, sku: string|null, name: string|null, pu: number, amount: number, net: number, rebate: number, taxrate: number, comment: string|null}>}> — The quote with its lines.
Throws
Error — If the quote is not found.
Example
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
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<{sku?: string, name?: string, pu?: number, amount: number, net: number, rebate?: number, taxrate: number, comment?: string | null}>` |
Returns
Promise<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|null, date: string, lines: Array<{id: number, sku: string|null, name: string|null, pu: number, amount: number, net: number, rebate: number, taxrate: number, comment: string|null}>}> — The updated quote.
Throws
Error — If the quote is not found.
Example
const quote = await store.quote.update(42, 5, { number: 'A-2026-002', lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }