Parent Directory
|
Revision Log
feat(api): auth middleware
1 | import { Schema, model, Document } from 'mongoose'; |
2 | |
3 | export interface IUser extends Document { |
4 | discord_id: string; |
5 | username: string; |
6 | guilds: Array<string>; |
7 | password?: string; |
8 | token?: string; |
9 | isAdmin?: boolean; |
10 | createdAt: Date; |
11 | tokenUpdatedAt?: Date; |
12 | } |
13 | |
14 | const schema = new Schema({ |
15 | username: { |
16 | type: String, |
17 | required: true, |
18 | unique: true |
19 | }, |
20 | discord_id: { |
21 | type: String, |
22 | required: true, |
23 | }, |
24 | guilds: { |
25 | type: Array, |
26 | required: true, |
27 | default: [] |
28 | }, |
29 | password: { |
30 | type: String, |
31 | required: false |
32 | }, |
33 | isAdmin: { |
34 | type: Boolean, |
35 | required: false, |
36 | default: false |
37 | }, |
38 | token: { |
39 | type: String, |
40 | required: false |
41 | }, |
42 | createdAt: { |
43 | type: Date, |
44 | required: true, |
45 | }, |
46 | tokenUpdatedAt: { |
47 | type: Date, |
48 | required: false, |
49 | } |
50 | }); |
51 | |
52 | export default model('User', schema); |
[email protected] | ViewVC Help |
Powered by ViewVC 1.1.26 |