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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 242 by rakin, Mon Jul 29 17:29:10 2024 UTC revision 331 by rakin, Mon Jul 29 17:29:35 2024 UTC
# Line 1  Line 1 
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, Document, SchemaTypes } from 'mongoose';
4    
5  class ChannelLock extends Model {}  // export interface IChannelLock extends Document {
6    //     user: string;
7    //     reason?: string;
8    //     mentions: Array<object>;
9    //     guild_id: string;
10    //     createdAt: Date;
11    // }
12    
13  ChannelLock.init({  const schema = new Schema({
     id: {  
         type: DataTypes.INTEGER,  
         autoIncrement: true,  
         primaryKey: true,  
     },  
14      reason: {      reason: {
15          type: DataTypes.TEXT,          type: String,
16          allowNull: true          required: false
17      },      },
18      user_id: {      user_id: {
19          type: DataTypes.STRING,          type: String,
20          allowNull: false          required: true
21      },      },
22      guild_id: {      guild_id: {
23          type: DataTypes.STRING,          type: String,
24          allowNull: false          required: true
25      },      },
26      channel_id: {      channel_id: {
27          type: DataTypes.STRING,          type: String,
28          unique: true,          unique: true,
29          allowNull: false          required: true
30      },      },
31      role_id: {      role_id: {
32          type: DataTypes.STRING,          type: String,
33          allowNull: false          required: true
34      },      },
35      previous_perms: {      previous_perms: {
36          type: DataTypes.JSON,          allow: Array,
37          allowNull: false          deny: Array
38        },
39        createdAt: {
40            type: Date,
41            required: true
42      }      }
 }, {  
     sequelize: DiscordClient.client.db.sequelize,  
     modelName: 'ChannelLock',  
     updatedAt: false,  
     tableName: 'channel_lock'  
43  });  });
44    
 export default ChannelLock;  
45    // 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);

Legend:
Removed from v.242  
changed lines
  Added in v.331

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26