This commit is contained in:
seb
2026-10-14 13:31:23 +02:00
parent 3256ab233d
commit b718cdb047
12 changed files with 714 additions and 14 deletions

View File

@@ -104,19 +104,45 @@ Lists the quotes of the user's selected company.
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[opts]` | `object` | Optional pagination and filter options. |
| `[opts.offset=0]` | `number` | Number of quotes to skip. |
| `[opts.limit=50]` | `number` | Number of quotes to return. |
| `[opts.search]` | `string` | Free-text search matching quote number, external number, or customer name. |
| `[opts.seekMonths]` | `number` | Negative integer for cutoff months ago (e.g. -1). |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|null, date: string}>>` — The quotes.
`Promise<{quotes: Array<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|null, date: string, createdAt: string|null, lines: Array<{id: number, sku: string|null, name: string|null, pu: number, amount: number, net: number, rebate: number, taxrate: number, comment: string|null}>, positions?: number, grossTotal?: number, totalQuantity?: number, customerName?: string}>, total: number, unfilteredTotal: number, offset: number, limit: number}|Array<object>>` — The quotes.
**Example**
```js
const result = await store.quote.list(42, { offset: 0, limit: 50, search: 'A-1002' });
// => { quotes: [...], total: 10, unfilteredTotal: 42, offset: 0, limit: 50 }
const quotes = await store.quote.list(42);
// => [{ id, number, type, entityId, externalNumber, date }]
// => [{ id, number, type, entityId, externalNumber, date, createdAt, lines: [...] }]
```
## `quote.rebuildSummaries`
*Source: `src/store/quote/rebuildSummaries.js`*
Rebuilds the `quotesummary` table for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `provider` | `import('../../providers/provider.js').DatabaseProvider` | |
## `quote.syncSummary`
*Source: `src/store/quote/syncSummary.js`*
Centralized sync and rebuild logic for the materialized `quotesummary` table.
## `quote.update`
*Source: `src/store/quote/update.js`*