diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
commit | 4176b6258e44e4a095376aaf0f4c687244243a69 (patch) | |
tree | 3b9144be9a2045483c90d92fff05b3ca0b288e52 /src/lib/models/Modlog.ts | |
parent | e80446e23060c0325bbd6db620920d86694ec3ce (diff) | |
download | tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.gz tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.bz2 tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.zip |
feat(*): Began working on other punishment commands etc
Diffstat (limited to 'src/lib/models/Modlog.ts')
-rw-r--r-- | src/lib/models/Modlog.ts | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/lib/models/Modlog.ts b/src/lib/models/Modlog.ts index 15c5030..94c464d 100644 --- a/src/lib/models/Modlog.ts +++ b/src/lib/models/Modlog.ts @@ -2,18 +2,20 @@ import { DataTypes, Sequelize } from 'sequelize'; import { v4 as uuidv4 } from 'uuid'; import { BaseModel } from './BaseModel'; -export enum ModlogType { +export enum ModLogType { BAN = 'BAN', - TEMPBAN = 'TEMPBAN', + TEMP_BAN = 'TEMP_BAN', KICK = 'KICK', MUTE = 'MUTE', - TEMPMUTE = 'TEMPMUTE', - WARN = 'WARN' + TEMP_MUTE = 'TEMP_MUTE', + WARN = 'WARN', + PUNISHMENT_ROLE = 'PUNISHMENT_ROLE', + TEMP_PUNISHMENT_ROLE = 'TEMP_PUNISHMENT_ROLE' } -export interface ModlogModel { +export interface ModLogModel { id: string; - type: ModlogType; + type: ModLogType; user: string; moderator: string; reason: string; @@ -21,9 +23,9 @@ export interface ModlogModel { guild: string; } -export interface ModlogModelCreationAttributes { +export interface ModLogModelCreationAttributes { id?: string; - type: ModlogType; + type: ModLogType; user: string; moderator: string; reason?: string; @@ -31,9 +33,9 @@ export interface ModlogModelCreationAttributes { guild: string; } -export class Modlog extends BaseModel<ModlogModel, ModlogModelCreationAttributes> implements ModlogModel { +export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel { id: string; - type: ModlogType; + type: ModLogType; user: string; moderator: string; guild: string; @@ -41,7 +43,7 @@ export class Modlog extends BaseModel<ModlogModel, ModlogModelCreationAttributes duration: number | null; static initModel(sequelize: Sequelize): void { - Modlog.init( + ModLog.init( { id: { type: DataTypes.STRING, @@ -50,7 +52,7 @@ export class Modlog extends BaseModel<ModlogModel, ModlogModelCreationAttributes defaultValue: uuidv4 }, type: { - type: new DataTypes.ENUM('BAN', 'TEMPBAN', 'MUTE', 'TEMPMUTE', 'KICK', 'WARN'), + type: DataTypes.STRING, //# This is not an enum because of a sequelize issue: https://github.com/sequelize/sequelize/issues/2554 allowNull: false }, user: { @@ -70,14 +72,14 @@ export class Modlog extends BaseModel<ModlogModel, ModlogModelCreationAttributes allowNull: true }, guild: { - type: DataTypes.STRING - // references: { - // model: Models.Guild, - // key: 'id' - // } + type: DataTypes.STRING, + references: { + model: 'Guilds', + key: 'id' + } } }, - { sequelize } + { sequelize: sequelize } ); } } |