-
Notifications
You must be signed in to change notification settings - Fork 592
/
user.js
37 lines (34 loc) · 919 Bytes
/
user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
import caller from 'grpc-caller';
import path from 'path';
export async function createGraphUser(
tenant: string,
email: string,
isOwner: boolean,
) {
const user = caller(
`${process.env.GRAPH_HOST || 'graph'}:443`,
path.resolve(__dirname, 'graph.proto'),
'UserService',
);
await user
.Create({tenant, id: email, isOwner})
.catch(err => console.error(err));
}
export async function deleteGraphUser(tenant: string, email: string) {
const user = caller(
`${process.env.GRAPH_HOST || 'graph'}:443`,
path.resolve(__dirname, 'graph.proto'),
'UserService',
);
await user.Delete({tenant, id: email}).catch(err => console.error(err));
}