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

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

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

revision 86 by rakin, Mon Jul 29 17:28:32 2024 UTC revision 336 by rakin, Mon Jul 29 17:29:36 2024 UTC
# Line 1  Line 1 
1  import { DataTypes, Model } from 'sequelize';  import { Schema, model } from 'mongoose';
 import DiscordClient from '../client/Client';  
2    
3  class Punishment extends Model {}  export interface IPunishment {
4        user_id: string
5        mod_id: string
6        mod_tag: string,
7        guild_id: string;
8        reason?: string;
9        type: string
10        meta?: object;
11        createdAt: Date;
12    }
13    
14  Punishment.init({  const schema = new Schema({
     id: {  
         type: DataTypes.INTEGER,  
         primaryKey: true,  
         autoIncrement: true,  
         allowNull: false,  
     },  
15      user_id: {      user_id: {
16          type: DataTypes.STRING,          type: String,
17          allowNull: false,          required: true,
18      },      },
19      mod_id: {      mod_id: {
20          type: DataTypes.STRING,          type: String,
21          allowNull: false,          required: true,
22      },      },
23      mod_tag: {      mod_tag: {
24          type: DataTypes.STRING,          type: String,
25          allowNull: false,          required: true,
26      },      },
27      guild_id: {      guild_id: {
28          type: DataTypes.STRING,          type: String,
29          allowNull: false,          required: true,
30      },      },
31      reason: {      reason: {
32          type: DataTypes.TEXT,          type: String,
33          allowNull: true          required: false
34      },      },
35      type: {      type: {
36          type: DataTypes.STRING,          type: String,
37          allowNull: false          required: true
38      },      },
39      meta: {      meta: {
40          type: DataTypes.JSON,          type: Object,
41          allowNull: false,          required: true,
42          defaultValue: {}          default: {}
43      },      },
44  }, {      createdAt: {
45      sequelize: DiscordClient.client.db.sequelize,          type: Date,
46      modelName: 'Punishment',          required: true
47      updatedAt: false,      }
     tableName: 'punishments'  
48  });  });
49    
 export default Punishment;  
50    // class Punishment extends Model {}
51    
52    // Punishment.init({
53    //     id: {
54    //         type: DataTypes.INTEGER,
55    //         primaryKey: true,
56    //         autoIncrement: true,
57    //         allowNull: false,
58    //     },
59    //     user_id: {
60    //         type: DataTypes.STRING,
61    //         allowNull: false,
62    //     },
63    //     mod_id: {
64    //         type: DataTypes.STRING,
65    //         allowNull: false,
66    //     },
67    //     mod_tag: {
68    //         type: DataTypes.STRING,
69    //         allowNull: false,
70    //     },
71    //     guild_id: {
72    //         type: DataTypes.STRING,
73    //         allowNull: false,
74    //     },
75    //     reason: {
76    //         type: DataTypes.TEXT,
77    //         allowNull: true
78    //     },
79    //     type: {
80    //         type: DataTypes.STRING,
81    //         allowNull: false
82    //     },
83    //     meta: {
84    //         type: DataTypes.JSON,
85    //         allowNull: false,
86    //         defaultValue: {}
87    //     },
88    // }, {
89    //     sequelize: DiscordClient.client.db.sequelize,
90    //     modelName: 'Punishment',
91    //     updatedAt: false,
92    //     tableName: 'punishments'
93    // });
94    
95    export default model('Punishment', schema);

Legend:
Removed from v.86  
changed lines
  Added in v.336

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26