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
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import type Authenticator from '../types/Authenticator';
import type Subscription from '../types/Subscription';
import type User from '../types/User';
import env from '../_env';
const prefix = env.ENVIRONMENT === 'prod' ? '' : 'dev_';
type TableSchema<Model> = {
name: string,
fields: { [key in keyof Model]: string },
};
export const AUTHENTICATORS: TableSchema<Authenticator> = {
name: `${prefix}authenticators`,
fields: {
id: 'id',
backedUp: 'backed_up',
counter: 'counter',
deviceType: 'device_type',
publicKey: 'public_key',
transports: 'transports',
type: 'type',
userId: 'user_id',
},
};
export const CURRENT_CHALLENGES: TableSchema<{ userId: User['id'], currentChallenge: string }> = {
name: `${prefix}current_challenges`,
fields: {
userId: 'user_id',
currentChallenge: 'current_challenge',
},
};
export const SUBSCRIPTIONS: TableSchema<Subscription> = {
name: `${prefix}subscriptions`,
fields: {
id: 'id',
emailAddress: 'email_address',
},
};
export const USERS: TableSchema<User> = {
name: `${prefix}users`,
fields: {
id: 'id',
displayName: 'display_name',
},
};
|