/[sudobot]/trunk/src/models/User.ts
ViewVC logotype

Contents of /trunk/src/models/User.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 349 - (show annotations)
Mon Jul 29 17:29:43 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 971 byte(s)
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