aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/models')
-rw-r--r--src/lib/models/Guild.ts4
-rw-r--r--src/lib/models/ModLog.ts8
-rw-r--r--src/lib/models/__helpers.ts12
3 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts
index 9b283ab..f59bed1 100644
--- a/src/lib/models/Guild.ts
+++ b/src/lib/models/Guild.ts
@@ -355,10 +355,10 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i
logChannels: {
type: DataTypes.TEXT,
get: function (): LogChannelDB {
- return jsonParseGet('logChannels', this);
+ return jsonParseGet.call(this, 'logChannels');
},
set: function (val: LogChannelDB) {
- return jsonParseSet('logChannels', this, val);
+ return jsonParseSet.call(this, 'logChannels', val);
},
allowNull: false,
defaultValue: '{}'
diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts
index a70913d..3675649 100644
--- a/src/lib/models/ModLog.ts
+++ b/src/lib/models/ModLog.ts
@@ -191,10 +191,10 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes
pseudo: {
type: DataTypes.STRING,
get: function (): boolean {
- return jsonParseGet('pseudo', this);
+ return jsonParseGet.call(this, 'pseudo');
},
set: function (val: boolean) {
- return jsonParseSet('pseudo', this, val);
+ return jsonParseSet.call(this, 'pseudo', val);
},
allowNull: false,
defaultValue: 'false'
@@ -202,10 +202,10 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes
hidden: {
type: DataTypes.STRING,
get: function (): boolean {
- return jsonParseGet('hidden', this);
+ return jsonParseGet.call(this, 'hidden');
},
set: function (val: boolean) {
- return jsonParseSet('hidden', this, val);
+ return jsonParseSet.call(this, 'hidden', val);
},
allowNull: false,
defaultValue: 'false'
diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts
index b65c014..243b274 100644
--- a/src/lib/models/__helpers.ts
+++ b/src/lib/models/__helpers.ts
@@ -1,21 +1,21 @@
import { DataTypes, Model } from 'sequelize';
export const NEVER_USED = 'This should never be executed';
-export function jsonParseGet(key: string, that: Model): any {
- return JSON.parse(that.getDataValue(key));
+export function jsonParseGet(this: Model, key: string): any {
+ return JSON.parse(this.getDataValue(key));
}
-export function jsonParseSet(key: string, that: Model, value: any): any {
- return that.setDataValue(key, JSON.stringify(value));
+export function jsonParseSet(this: Model, key: string, value: any): any {
+ return this.setDataValue(key, JSON.stringify(value));
}
export function jsonArrayInit(key: string): any {
return {
type: DataTypes.TEXT,
get: function (): string[] {
- return jsonParseGet(key, this);
+ return jsonParseGet.call(this, key);
},
set: function (val: string[]) {
- return jsonParseSet(key, this, val);
+ return jsonParseSet.call(this, key, val);
},
allowNull: false,
defaultValue: '[]'