This commit is contained in:
seb
2026-10-04 09:33:27 +02:00
parent 3b74c12f4e
commit 89fe6e6451
14 changed files with 1836 additions and 1546 deletions

View File

@@ -2,6 +2,36 @@
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `company.addHistory`
*Source: `src/store/company/addHistory.js`*
Adds an entry to the company history for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object|string` | The history input object or text string. |
| `[input.text]` | `string` | The history entry text. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, companyuserId: number|null, date: string, text: string}>` — The inserted entry.
**Throws**
`Error` — If text is missing or user is not authorized.
**Example**
```js
const entry = await store.company.addHistory(42, { text: 'API suggestion: add barcode scanner endpoint' });
// => { id, companyuserId, date, text }
```
## `company.create`
*Source: `src/store/company/create.js`*
@@ -112,6 +142,35 @@ const company = await store.company.getByName('Acme');
// => { id, name, ... }
```
## `company.getHistory`
*Source: `src/store/company/getHistory.js`*
Returns the company history for the user's selected company, newest first.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[opts]` | `object` | Optional options. |
| `[opts.limit]` | `number` | Maximum number of entries to return (newest first). |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, companyuserId: number|null, date: string, text: string}>>` — The company history entries.
**Example**
```js
const history = await store.company.getHistory(42);
// => [{ id, companyuserId, date, text }]
const recent = await store.company.getHistory(42, { limit: 5 });
// => up to 5 most recent entries
```
## `company.list`
*Source: `src/store/company/list.js`*