Files
dashlibstorage/API.autoinvite.md
2026-11-02 00:19:21 +01:00

2.2 KiB

autoinvite

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

autoinvite.add

Source: src/store/autoinvite/add.js

Registers an email for automatic company membership. When that email is registered (google_auth.add) the invitation is consumed: it is removed from the list and the new user is added to the company with the given role.

Parameters

Name Type Description
googleAuthId number The id of the acting Google auth user (must be admin of the selected company).
input `{email: string, role?: 'admin' 'user'}`
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, email: string, role: 'admin'|'user'}> — The created invitation.

Throws

Error — 'Not authorized', 'Invalid email', 'Invalid role', 'User already registered', 'Invitation already exists'

Example

await store.autoinvite.add(42, { email: 'new@example.com', role: 'user' });

autoinvite.list

Source: src/store/autoinvite/list.js

Lists the pending auto-invitations of the admin's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user (must be admin of the selected company).
[tx] object Optional transaction to run within.

Returns

Promise<Array<{id: number, email: string, role: 'admin'|'user', createdAt: string}>> — The invitations ordered by email.

Throws

Error — 'Not authorized' / 'No company selected'

Example

const invites = await store.autoinvite.list(42);

autoinvite.remove

Source: src/store/autoinvite/remove.js

Deletes a pending auto-invitation of the admin's selected company.

Parameters

Name Type Description
googleAuthId number The id of the acting Google auth user (must be admin of the selected company).
id number The invitation id.
[tx] object Optional transaction to run within.

Returns

Promise<void>

Throws

Error — 'Not authorized', 'Invitation not found'

Example

await store.autoinvite.remove(42, 3);