forked from remoteoss/devsforukraine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xata.ts
122 lines (100 loc) · 2.96 KB
/
xata.ts
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import { buildClient, BaseClientOptions, XataRecord } from "@xata.io/client";
export interface NextauthUser {
email?: string | null;
emailVerified?: Date | null;
name?: string | null;
image?: string | null;
username?: string | null;
location?: string | null;
createdAt?: Date | null;
}
export type NextauthUserRecord = NextauthUser & XataRecord;
export interface NextauthAccount {
user?: NextauthUserRecord | null;
type?: string | null;
provider?: string | null;
providerAccountId?: string | null;
refresh_token?: string | null;
access_token?: string | null;
expires_at?: number | null;
token_type?: string | null;
scope?: string | null;
id_token?: string | null;
session_state?: string | null;
}
export type NextauthAccountRecord = NextauthAccount & XataRecord;
export interface NextauthVerificationToken {
identifier?: string | null;
token?: string | null;
expires?: Date | null;
}
export type NextauthVerificationTokenRecord = NextauthVerificationToken &
XataRecord;
export interface NextauthUsersAccount {
user?: NextauthUserRecord | null;
account?: NextauthAccountRecord | null;
}
export type NextauthUsersAccountRecord = NextauthUsersAccount & XataRecord;
export interface NextauthUsersSession {
user?: NextauthUserRecord | null;
session?: NextauthSessionRecord | null;
}
export type NextauthUsersSessionRecord = NextauthUsersSession & XataRecord;
export interface NextauthSession {
sessionToken?: string | null;
expires?: Date | null;
user?: NextauthUserRecord | null;
}
export type NextauthSessionRecord = NextauthSession & XataRecord;
export interface Ticket {
user?: NextauthUserRecord | null;
createdAt?: Date | null;
}
export type TicketRecord = Ticket & XataRecord;
export interface Speaker {
name?: string | null;
talk?: string | null;
image?: string | null;
videoUrl?: string | null;
twitter?: string | null;
position?: string | null;
}
export type SpeakerRecord = Speaker & XataRecord;
export interface Organizer {
name?: string | null;
title?: string | null;
twitter?: string | null;
image?: string | null;
}
export type OrganizerRecord = Organizer & XataRecord;
export type DatabaseSchema = {
nextauth_users: NextauthUser;
nextauth_accounts: NextauthAccount;
nextauth_verificationTokens: NextauthVerificationToken;
nextauth_users_accounts: NextauthUsersAccount;
nextauth_users_sessions: NextauthUsersSession;
nextauth_sessions: NextauthSession;
tickets: Ticket;
speakers: Speaker;
organizers: Organizer;
};
const tables = [
"nextauth_users",
"nextauth_accounts",
"nextauth_verificationTokens",
"nextauth_users_accounts",
"nextauth_users_sessions",
"nextauth_sessions",
"tickets",
"speakers",
"organizers",
];
const DatabaseClient = buildClient();
export class XataClient extends DatabaseClient<DatabaseSchema> {
constructor(options?: BaseClientOptions) {
super(
{ databaseURL: "https://xata-uq2d57.xata.sh/db/conf", ...options },
tables
);
}
}