-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstant.schema.ts
More file actions
54 lines (49 loc) · 1.17 KB
/
instant.schema.ts
File metadata and controls
54 lines (49 loc) · 1.17 KB
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
// Docs: https://www.instantdb.com/docs/modeling-data
import { i } from '@instantdb/react-native';
type BuildError = {
from: string;
status: number;
message: string;
};
const _schema = i.schema({
entities: {
$files: i.entity({
path: i.string().unique().indexed(),
url: i.string(),
}),
$users: i.entity({
email: i.string().unique().indexed().optional(),
}),
builds: i.entity({
instantAppId: i.string(),
code: i.string(),
reasoning: i.string().optional(),
slug: i.string().indexed().unique().optional(),
error: i.json<BuildError>().optional(),
isPreviewable: i.boolean().optional(),
title: i.string().optional(),
}),
},
links: {
buildOwner: {
forward: {
on: 'builds',
has: 'one',
label: 'owner',
required: true,
},
reverse: {
on: '$users',
has: 'many',
label: 'builds',
},
},
},
rooms: {},
});
// This helps Typescript display nicer intellisense
type _AppSchema = typeof _schema;
interface AppSchema extends _AppSchema {}
const schema: AppSchema = _schema;
export type { AppSchema };
export default schema;