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 ChannelLock extends Model {} |
import { Schema, model } from 'mongoose'; |
21 |
|
|
22 |
ChannelLock.init({ |
const schema = new Schema({ |
|
id: { |
|
|
type: DataTypes.INTEGER, |
|
|
autoIncrement: true, |
|
|
primaryKey: true, |
|
|
}, |
|
23 |
reason: { |
reason: { |
24 |
type: DataTypes.TEXT, |
type: String, |
25 |
allowNull: true |
required: false |
26 |
}, |
}, |
27 |
user_id: { |
user_id: { |
28 |
type: DataTypes.STRING, |
type: String, |
29 |
allowNull: false |
required: true |
30 |
}, |
}, |
31 |
guild_id: { |
guild_id: { |
32 |
type: DataTypes.STRING, |
type: String, |
33 |
allowNull: false |
required: true |
34 |
}, |
}, |
35 |
channel_id: { |
channel_id: { |
36 |
type: DataTypes.STRING, |
type: String, |
37 |
unique: true, |
unique: true, |
38 |
allowNull: false |
required: true |
39 |
}, |
}, |
40 |
role_id: { |
role_id: { |
41 |
type: DataTypes.STRING, |
type: String, |
42 |
allowNull: false |
required: true |
43 |
}, |
}, |
44 |
previous_perms: { |
previous_perms: { |
45 |
type: DataTypes.JSON, |
allow: Array, |
46 |
allowNull: false |
deny: Array |
47 |
|
}, |
48 |
|
createdAt: { |
49 |
|
type: Date, |
50 |
|
required: true |
51 |
} |
} |
|
}, { |
|
|
sequelize: DiscordClient.client.db.sequelize, |
|
|
modelName: 'ChannelLock', |
|
|
updatedAt: false, |
|
|
tableName: 'channel_lock' |
|
52 |
}); |
}); |
53 |
|
|
|
export default ChannelLock; |
|
54 |
|
export default model('ChannelLock', schema); |