1 |
import { DataTypes, Model } from 'sequelize'; |
/** |
2 |
import DiscordClient from '../client/Client'; |
* This file is part of SudoBot. |
3 |
|
* |
4 |
|
* Copyright (C) 2021-2022 OSN Inc. |
5 |
|
* |
6 |
|
* SudoBot is free software; you can redistribute it and/or modify it |
7 |
|
* under the terms of the GNU Affero General Public License as published by |
8 |
|
* the Free Software Foundation, either version 3 of the License, or |
9 |
|
* (at your option) any later version. |
10 |
|
* |
11 |
|
* SudoBot is distributed in the hope that it will be useful, but |
12 |
|
* WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
* GNU Affero General Public License for more details. |
15 |
|
* |
16 |
|
* You should have received a copy of the GNU Affero General Public License |
17 |
|
* along with SudoBot. If not, see <https://www.gnu.org/licenses/>. |
18 |
|
*/ |
19 |
|
|
20 |
class SpamViolation extends Model {} |
import { Schema, model } from 'mongoose'; |
21 |
|
|
22 |
SpamViolation.init({ |
export interface ISpamViolation { |
23 |
id: { |
user_id: string; |
24 |
type: DataTypes.INTEGER, |
guild_id: string; |
25 |
autoIncrement: true, |
strike?: number; |
26 |
primaryKey: true, |
createdAt: Date; |
27 |
}, |
} |
28 |
|
|
29 |
|
const schema = new Schema({ |
30 |
user_id: { |
user_id: { |
31 |
type: DataTypes.STRING, |
type: String, |
32 |
allowNull: false |
required: true |
33 |
}, |
}, |
34 |
guild_id: { |
guild_id: { |
35 |
type: DataTypes.STRING, |
type: String, |
36 |
allowNull: false |
required: true |
37 |
}, |
}, |
38 |
strike: { |
strike: { |
39 |
type: DataTypes.INTEGER, |
type: Number, |
40 |
allowNull: false, |
required: true, |
41 |
defaultValue: 1 |
default: 1 |
42 |
|
}, |
43 |
|
createdAt: { |
44 |
|
type: Date, |
45 |
|
required: true |
46 |
} |
} |
|
}, { |
|
|
sequelize: DiscordClient.client.db.sequelize, |
|
|
modelName: 'SpamViolation', |
|
|
updatedAt: false, |
|
|
tableName: 'spam_violation' |
|
47 |
}); |
}); |
48 |
|
|
|
export default SpamViolation; |
|
49 |
|
export default model('SpamViolation', schema); |