-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.ts
69 lines (57 loc) · 1.15 KB
/
database.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
interface Base {
createdAt: string;
id: number;
updatedAt: string;
}
export type ChatTypes = 'group' | 'private';
export type UserRoles = 'admin' | 'user';
export interface Chat extends Base {
createdBy: number;
name: string;
type: ChatTypes;
}
export interface Device extends Base {
deviceId: string;
deviceName: string;
userId: number;
}
export interface Message extends Base {
authorId: number;
chatId: number;
edited: boolean;
text: string;
}
export interface Password extends Base {
hash: string;
userId: number;
}
export interface Secret extends Base {
secret: string;
userId: number;
}
export interface User extends Base {
failedLoginAttempts: number;
login: string;
recoveryAnswer: string;
recoveryQuestion: string;
role: UserRoles;
}
export interface UserChat extends Base {
chatHidden: boolean;
chatId: number;
newMessages: number;
userId: number;
}
export interface CountResult {
count: number;
}
export interface Result extends Base {
[key: string]: any;
}
export interface PaginatedResult {
currentPage: number;
limit: number;
results: Result[];
totalCount: number;
totalPages: number;
}