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

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

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

revision 59 by rakin, Mon Jul 29 17:28:25 2024 UTC revision 328 by rakin, Mon Jul 29 17:29:34 2024 UTC
# Line 1  Line 1 
1  import { DataTypes, Model } from 'sequelize';  import { Schema, model, Document } from 'mongoose';
 import DiscordClient from '../client/Client';  
2    
3  class Ballot extends Model {}  export interface IBallot extends Document {
4        user: string;
5        reason?: string;
6        mentions: Array<object>;
7        guild_id: string;
8        createdAt: Date;
9    }
10    
11  Ballot.init({  const schema = new Schema({
     // Model attributes are defined here  
     id: {  
         type: DataTypes.INTEGER,  
         autoIncrement: true,  
         primaryKey: true,  
     },  
12      content: {      content: {
13          type: DataTypes.STRING,          type: String,
14          allowNull: false          required: true
15      },      },
16      author: {      author: {
17          type: DataTypes.STRING,          type: String,
18          allowNull: true          required: true
19      },      },
20      msg_id: {      msg_id: {
21          type: DataTypes.STRING,          type: String,
22          allowNull: false          required: true
23      },      },
24      channel_id: {      channel_id: {
25          type: DataTypes.STRING,          type: String,
26          allowNull: false          required: true
27      },      },
28      guild_id: {      guild_id: {
29          type: DataTypes.STRING,          type: String,
30          allowNull: false          required: true
31      },      },
32      date: {      date: {
33          type: DataTypes.DATE,          type: Date,
34          allowNull: false,          required: true,
35      }      }
 }, {  
     sequelize: DiscordClient.client.db.sequelize,  
     modelName: 'Ballot',  
     timestamps: false,  
36  });  });
37    
 export default Ballot;  
38    export default model('Ballot', schema);

Legend:
Removed from v.59  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26