This commit is contained in:
seb
2026-10-09 10:41:17 +02:00
parent 760f074b4e
commit f3674edcb7
24 changed files with 1181 additions and 0 deletions

84
API.account.md Normal file
View File

@@ -0,0 +1,84 @@
# account
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `account.create`
*Source: `src/store/account/create.js`*
Creates an account for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | Account input. |
| `input.type` | `string` | Account type. |
| `input.name` | `string` | Account name. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, companyId: number, type: string, name: string}>`
**Throws**
`Error` — If type or name is missing.
**Example**
```js
const account = await store.account.create(googleAuthId, { type: 'bank', name: 'Main' });
```
## `account.delete`
*Source: `src/store/account/delete.js`*
Deletes an account of the user's selected company. Its payments are removed by cascade.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The account id. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<void>`
**Throws**
`Error` — If the account id is invalid.
**Example**
```js
await store.account.delete(googleAuthId, 3);
```
## `account.list`
*Source: `src/store/account/list.js`*
Lists accounts for the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<Array<{id: number, companyId: number, type: string, name: string}>>`
**Example**
```js
const accounts = await store.account.list(googleAuthId);
```