85 lines
1.6 KiB
Markdown
85 lines
1.6 KiB
Markdown
# google_auth
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `google_auth.add`
|
|
|
|
*Source: `src/store/google_auth/add.js`*
|
|
|
|
Adds a new allowed Google auth email.
|
|
|
|
```js
|
|
const fn = add(pool);
|
|
const id = await fn('user@example.com');
|
|
// => 1
|
|
```
|
|
|
|
## `google_auth.getByEmail`
|
|
|
|
*Source: `src/store/google_auth/getByEmail.js`*
|
|
|
|
Returns a Google auth row by email.
|
|
|
|
```js
|
|
const fn = getByEmail(pool);
|
|
const auth = await fn('user@example.com');
|
|
// => { id, email, ... }
|
|
```
|
|
|
|
## `google_auth.getById`
|
|
|
|
*Source: `src/store/google_auth/getById.js`*
|
|
|
|
Returns a Google auth row by its id.
|
|
|
|
```js
|
|
const fn = getById(pool);
|
|
const auth = await fn(42);
|
|
// => { id, email, ... }
|
|
```
|
|
|
|
## `google_auth.listAllowedEmails`
|
|
|
|
*Source: `src/store/google_auth/listAllowedEmails.js`*
|
|
|
|
Lists all allowed Google auth emails.
|
|
|
|
```js
|
|
const fn = listAllowedEmails(pool);
|
|
const emails = await fn();
|
|
// => [{ id, email }]
|
|
```
|
|
|
|
## `google_auth.removeAllowedEmail`
|
|
|
|
*Source: `src/store/google_auth/removeAllowedEmail.js`*
|
|
|
|
Removes an allowed Google auth email.
|
|
|
|
```js
|
|
const fn = removeAllowedEmail(pool);
|
|
await fn('user@example.com');
|
|
```
|
|
|
|
## `google_auth.setProfile`
|
|
|
|
*Source: `src/store/google_auth/setProfile.js`*
|
|
|
|
Updates the profile (picture, picture binary, sub) of a Google auth user.
|
|
|
|
```js
|
|
const fn = setProfile(pool);
|
|
await fn(42, { picture: 'url', pictureBinary: buffer, sub: 'sub' });
|
|
```
|
|
|
|
## `google_auth.setSelectedCompany`
|
|
|
|
*Source: `src/store/google_auth/setSelectedCompany.js`*
|
|
|
|
Sets the currently selected company for a Google auth user.
|
|
|
|
```js
|
|
const fn = setSelectedCompany(pool);
|
|
await fn(42, 1);
|
|
```
|