/[sudobot]/trunk/src/models/ChannelLock.ts
ViewVC logotype

Annotation of /trunk/src/models/ChannelLock.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 331 - (hide annotations)
Mon Jul 29 17:29:35 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1833 byte(s)
refactor(locking): use mongodb
1 rakin 241 import { DataTypes, Model } from 'sequelize';
2     import DiscordClient from '../client/Client';
3 rakin 331 import { Schema, model, Document, SchemaTypes } from 'mongoose';
4 rakin 241
5 rakin 331 // export interface IChannelLock extends Document {
6     // user: string;
7     // reason?: string;
8     // mentions: Array<object>;
9     // guild_id: string;
10     // createdAt: Date;
11     // }
12 rakin 241
13 rakin 331 const schema = new Schema({
14 rakin 241 reason: {
15 rakin 331 type: String,
16     required: false
17 rakin 241 },
18     user_id: {
19 rakin 331 type: String,
20     required: true
21 rakin 241 },
22     guild_id: {
23 rakin 331 type: String,
24     required: true
25 rakin 241 },
26     channel_id: {
27 rakin 331 type: String,
28 rakin 242 unique: true,
29 rakin 331 required: true
30 rakin 241 },
31 rakin 242 role_id: {
32 rakin 331 type: String,
33     required: true
34 rakin 242 },
35 rakin 241 previous_perms: {
36 rakin 331 allow: Array,
37     deny: Array
38     },
39     createdAt: {
40     type: Date,
41     required: true
42 rakin 241 }
43     });
44    
45 rakin 331 // class ChannelLock extends Model {}
46    
47     // ChannelLock.init({
48     // id: {
49     // type: DataTypes.INTEGER,
50     // autoIncrement: true,
51     // primaryKey: true,
52     // },
53     // reason: {
54     // type: DataTypes.TEXT,
55     // allowNull: true
56     // },
57     // user_id: {
58     // type: DataTypes.STRING,
59     // allowNull: false
60     // },
61     // guild_id: {
62     // type: DataTypes.STRING,
63     // allowNull: false
64     // },
65     // channel_id: {
66     // type: DataTypes.STRING,
67     // unique: true,
68     // allowNull: false
69     // },
70     // role_id: {
71     // type: DataTypes.STRING,
72     // allowNull: false
73     // },
74     // previous_perms: {
75     // type: DataTypes.JSON,
76     // allowNull: false
77     // }
78     // }, {
79     // sequelize: DiscordClient.client.db.sequelize,
80     // modelName: 'ChannelLock',
81     // updatedAt: false,
82     // tableName: 'channel_lock'
83     // });
84    
85     export default model('ChannelLock', schema);

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26