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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 336 - (hide annotations)
Mon Jul 29 17:29:36 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1891 byte(s)
refactor(moderation): use mongodb
1 rakin 336 import { Schema, model } from 'mongoose';
2 rakin 85
3 rakin 336 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 rakin 85
14 rakin 336 const schema = new Schema({
15 rakin 85 user_id: {
16 rakin 336 type: String,
17     required: true,
18 rakin 85 },
19     mod_id: {
20 rakin 336 type: String,
21     required: true,
22 rakin 85 },
23 rakin 86 mod_tag: {
24 rakin 336 type: String,
25     required: true,
26 rakin 86 },
27 rakin 85 guild_id: {
28 rakin 336 type: String,
29     required: true,
30 rakin 85 },
31     reason: {
32 rakin 336 type: String,
33     required: false
34 rakin 85 },
35     type: {
36 rakin 336 type: String,
37     required: true
38 rakin 85 },
39     meta: {
40 rakin 336 type: Object,
41     required: true,
42     default: {}
43 rakin 85 },
44 rakin 336 createdAt: {
45     type: Date,
46     required: true
47     }
48 rakin 85 });
49    
50 rakin 336 // 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);

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26