1 |
import { DataTypes, Model } from 'sequelize'; |
import { Schema, model, SchemaTypes, Document } from 'mongoose'; |
|
import DiscordClient from '../client/Client'; |
|
2 |
|
|
3 |
class AFK extends Model {} |
export interface IAFK extends Document { |
4 |
|
user: string; |
5 |
|
reason?: string; |
6 |
|
mentions: Array<object>; |
7 |
|
guild_id: string; |
8 |
|
createdAt: Date; |
9 |
|
} |
10 |
|
|
11 |
AFK.init({ |
const schema = new Schema({ |
|
id: { |
|
|
type: DataTypes.INTEGER, |
|
|
autoIncrement: true, |
|
|
primaryKey: true, |
|
|
}, |
|
12 |
user: { |
user: { |
13 |
type: DataTypes.STRING, |
type: String, |
14 |
allowNull: false |
required: true |
15 |
}, |
}, |
16 |
reason: { |
reason: { |
17 |
type: DataTypes.STRING, |
type: String, |
18 |
allowNull: true |
required: false |
|
}, |
|
|
mentions: { |
|
|
type: DataTypes.JSON, |
|
|
allowNull: false, |
|
|
defaultValue: [] |
|
19 |
}, |
}, |
20 |
|
mentions: Array, |
21 |
guild_id: { |
guild_id: { |
22 |
type: DataTypes.STRING, |
type: String, |
23 |
allowNull: false |
required: true |
24 |
}, |
}, |
25 |
}, { |
createdAt: { |
26 |
sequelize: DiscordClient.client.db.sequelize, |
type: Date, |
27 |
modelName: 'AFK', |
required: true |
28 |
updatedAt: false, |
} |
29 |
}); |
}); |
30 |
|
|
|
export default AFK; |
|
31 |
|
export default model('AFK', schema); |