-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstant.schema.ts
66 lines (63 loc) · 1.15 KB
/
instant.schema.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
import "dotenv/config";
import { i } from "@instantdb/react";
const graph = i.graph(
{
drawings: i.entity({
name: i.string(),
state: i.json(),
}),
invites: i.entity({
teamId: i.string(),
teamName: i.string(),
userEmail: i.string(),
}),
memberships: i.entity({
teamId: i.string(),
userEmail: i.string(),
userId: i.string(),
}),
teams: i.entity({
creatorId: i.string(),
name: i.string(),
}),
},
{
drawingsTeams: {
forward: {
on: "drawings",
has: "one",
label: "teams",
},
reverse: {
on: "teams",
has: "many",
label: "drawings",
},
},
invitesTeams: {
forward: {
on: "invites",
has: "one",
label: "teams",
},
reverse: {
on: "teams",
has: "many",
label: "invites",
},
},
membershipsTeams: {
forward: {
on: "memberships",
has: "one",
label: "teams",
},
reverse: {
on: "teams",
has: "many",
label: "memberships",
},
},
}
);
export default graph;