Files
dashlibstorage/API.companyuser.md
2026-09-24 23:26:25 +02:00

76 lines
1.5 KiB
Markdown

# companyuser
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `companyuser.add`
*Source: `src/store/companyuser/add.js`*
Adds a company user linking a company to a Google auth account.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `companyId` | `number` | The id of the company. |
| `googleAuthId` | `number` | The id of the Google auth account. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<number>` — The id of the created company user link.
**Example**
```js
const id = await store.companyuser.add(1, 42);
// => 7
```
## `companyuser.delete`
*Source: `src/store/companyuser/delete.js`*
Deletes a company user link by its id.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `id` | `number` | The id of the company user link to delete. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<void>`
**Example**
```js
await store.companyuser.delete(7);
```
## `companyuser.getByEmail`
*Source: `src/store/companyuser/getByEmail.js`*
Returns the company user ids associated with the given email address.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `email` | `string` | The email address. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<Array<number>>` — The company user ids.
**Example**
```js
const ids = await store.companyuser.getByEmail('user@example.com');
// => [1, 2, 3]
```