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