aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/ModLog.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/models/ModLog.ts')
-rw-r--r--src/lib/models/ModLog.ts73
1 files changed, 45 insertions, 28 deletions
diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts
index 0151cf6..b2351b9 100644
--- a/src/lib/models/ModLog.ts
+++ b/src/lib/models/ModLog.ts
@@ -1,6 +1,6 @@
-import { Snowflake } from 'discord.js';
+import { type Snowflake } from 'discord.js';
import { nanoid } from 'nanoid';
-import { DataTypes, Sequelize } from 'sequelize';
+import { DataTypes, type Sequelize } from 'sequelize';
import { BaseModel } from './BaseModel';
import { jsonBoolean } from './__helpers';
@@ -47,45 +47,62 @@ export interface ModLogModelCreationAttributes {
hidden?: boolean;
}
-// declaration merging so that the fields don't override Sequelize's getters
-export interface ModLog {
- /** The primary key of the modlog entry. */
- id: string;
+export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel {
+ /**
+ * The primary key of the modlog entry.
+ */
+ public declare id: string;
+
+ /**
+ * The type of punishment.
+ */
+ public declare type: ModLogType;
- /** The type of punishment. */
- type: ModLogType;
+ /**
+ * The user being punished.
+ */
+ public declare user: Snowflake;
- /** The user being punished. */
- user: Snowflake;
+ /**
+ * The user carrying out the punishment.
+ */
+ public declare moderator: Snowflake;
- /** The user carrying out the punishment. */
- moderator: Snowflake;
-
- /** The reason the user is getting punished. */
- reason: string | null;
+ /**
+ * The reason the user is getting punished.
+ */
+ public declare reason: string | null;
- /** The amount of time the user is getting punished for. */
- duration: number | null;
+ /**
+ * The amount of time the user is getting punished for.
+ */
+ public declare duration: number | null;
- /** The guild the user is getting punished in. */
- guild: Snowflake;
+ /**
+ * The guild the user is getting punished in.
+ */
+ public declare guild: Snowflake;
- /** Evidence of what the user is getting punished for. */
- evidence: string;
+ /**
+ * Evidence of what the user is getting punished for.
+ */
+ public declare evidence: string;
- /** Not an actual modlog just used so a punishment entry can be made. */
- pseudo: boolean;
+ /**
+ * Not an actual modlog just used so a punishment entry can be made.
+ */
+ public declare pseudo: boolean;
- /** Hides from the modlog command unless show hidden is specified. */
- hidden: boolean;
-}
+ /**
+ * Hides from the modlog command unless show hidden is specified.
+ */
+ public declare hidden: boolean;
-export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel {
public static initModel(sequelize: Sequelize): void {
ModLog.init(
{
id: { type: DataTypes.STRING, primaryKey: true, allowNull: false, defaultValue: nanoid },
- type: { type: DataTypes.STRING, allowNull: false }, //# This is not an enum because of a sequelize issue: https://github.com/sequelize/sequelize/issues/2554
+ type: { type: DataTypes.STRING, allowNull: false }, //? This is not an enum because of a sequelize issue: https://github.com/sequelize/sequelize/issues/2554
user: { type: DataTypes.STRING, allowNull: false },
moderator: { type: DataTypes.STRING, allowNull: false },
duration: { type: DataTypes.STRING, allowNull: true },