This commit is contained in:
seb
2026-10-23 22:22:32 +02:00
parent 82ab27ef2b
commit c172f2f4b1
6 changed files with 285 additions and 91 deletions

View File

@@ -209,22 +209,26 @@ Returns the change history of an article by its SKU.
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `sku` | `string` | The article SKU. |
| `[opts]` | `object` | Optional options. |
| `[opts.limit]` | `number` | Maximum number of entries to return (newest first). |
| `[opts]` | `object` | Optional pagination and filter options. |
| `[opts.offset=0]` | `number` | Number of entries to skip. |
| `[opts.limit=50]` | `number` | Number of entries to return. |
| `[opts.search]` | `string` | Optional search filter for history text. |
| `[opts.seekMonths]` | `number` | Negative integer cutoff months ago. |
| `[opts.paged]` | `boolean` | Explicitly return paged result object. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, companyuserId: number|null, date: string, text: string, meta: string|null}>>` — The article history entries.
`Promise<{history: Array<{id: number, companyuserId: number|null, date: string, text: string, meta: string|null}>, total: number, unfilteredTotal: number, offset: number, limit: number}|Array<{id: number, companyuserId: number|null, date: string, text: string, meta: string|null}>>` — The article history entries.
**Example**
```js
const result = await store.article.getHistoryBySku(42, 'SKU-1', { offset: 0, limit: 50, search: 'Tee' });
// => { history: [...], total, unfilteredTotal, offset, limit }
const history = await store.article.getHistoryBySku(42, 'SKU-1');
// => [{ id, companyuserId, date, text, meta }]
const recent = await store.article.getHistoryBySku(42, 'SKU-1', { limit: 5 });
// => up to 5 most recent entries
```
## `article.importRows`