1 |
import { DataTypes, Model } from 'sequelize'; |
import { DataTypes, Model } from 'sequelize'; |
2 |
import DiscordClient from '../client/Client'; |
import DiscordClient from '../client/Client'; |
3 |
|
import { Schema, model } from 'mongoose'; |
4 |
|
|
5 |
class SpamViolation extends Model {} |
export interface ISpamViolation { |
6 |
|
user_id: string; |
7 |
|
guild_id: string; |
8 |
|
strike?: number; |
9 |
|
createdAt: Date; |
10 |
|
} |
11 |
|
|
12 |
SpamViolation.init({ |
const schema = new Schema({ |
|
id: { |
|
|
type: DataTypes.INTEGER, |
|
|
autoIncrement: true, |
|
|
primaryKey: true, |
|
|
}, |
|
13 |
user_id: { |
user_id: { |
14 |
type: DataTypes.STRING, |
type: String, |
15 |
allowNull: false |
required: true |
16 |
}, |
}, |
17 |
guild_id: { |
guild_id: { |
18 |
type: DataTypes.STRING, |
type: String, |
19 |
allowNull: false |
required: true |
20 |
}, |
}, |
21 |
strike: { |
strike: { |
22 |
type: DataTypes.INTEGER, |
type: Number, |
23 |
allowNull: false, |
required: true, |
24 |
defaultValue: 1 |
default: 1 |
25 |
|
}, |
26 |
|
createdAt: { |
27 |
|
type: Date, |
28 |
|
required: true |
29 |
} |
} |
|
}, { |
|
|
sequelize: DiscordClient.client.db.sequelize, |
|
|
modelName: 'SpamViolation', |
|
|
updatedAt: false, |
|
|
tableName: 'spam_violation' |
|
30 |
}); |
}); |
31 |
|
|
|
export default SpamViolation; |
|
32 |
|
export default model('SpamViolation', schema); |