-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.ts
46 lines (40 loc) · 1.25 KB
/
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
/** @file Type definitions for database tables. */
import * as newtype from './newtype'
import * as reactionModule from './reaction'
// ==============
// === Schema ===
// ==============
export type UserId = newtype.Newtype<string, 'UserId'>
export type DiscordUserId = newtype.Newtype<string, 'DiscordUserId'>
export type EmailAddress = newtype.Newtype<string, 'EmailAddress'>
export type ThreadId = newtype.Newtype<string, 'ThreadId'>
export type MessageId = newtype.Newtype<string, 'MessageId'>
export interface User {
id: UserId
discordId: DiscordUserId | null
email: EmailAddress | null
name: string
/** Null when the user has not yet set an avatar. */
avatarUrl: string | null
/** Null when the user has not yet opened their first thread. */
currentThreadId: ThreadId | null
}
export interface Thread {
discordThreadId: ThreadId
userId: UserId
title: string
lastMessageReadId: MessageId
lastMessageSentId: MessageId
}
export interface Message {
discordMessageId: MessageId
discordThreadId: ThreadId
discordAuthorId: DiscordUserId | null
content: string
createdAt: number
editedAt: number
}
export interface Reaction {
discordMessageId: MessageId
reaction: reactionModule.ReactionSymbol
}