aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/Shared.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-04 11:05:30 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-04 11:05:30 -0500
commite5bc336f9586b1f5515be3f1d239d2194489e9c5 (patch)
tree5bcf124dc277f23ee5b812b9f93a385bf9180f1f /src/lib/models/Shared.ts
parent2db87acac4fe36baa93db0a8e52d7a83b3ce2998 (diff)
downloadtanzanite-e5bc336f9586b1f5515be3f1d239d2194489e9c5.tar.gz
tanzanite-e5bc336f9586b1f5515be3f1d239d2194489e9c5.tar.bz2
tanzanite-e5bc336f9586b1f5515be3f1d239d2194489e9c5.zip
refactor models
Diffstat (limited to 'src/lib/models/Shared.ts')
-rw-r--r--src/lib/models/Shared.ts81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/lib/models/Shared.ts b/src/lib/models/Shared.ts
deleted file mode 100644
index acb5c1e..0000000
--- a/src/lib/models/Shared.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { Snowflake } from 'discord.js';
-import type { Sequelize } from 'sequelize';
-import type { BadWords } from '../common/AutoMod.js';
-import { BaseModel } from './BaseModel.js';
-const { DataTypes } = (await import('sequelize')).default;
-
-export interface SharedModel {
- primaryKey: 0;
- superUsers: Snowflake[];
- privilegedUsers: Snowflake[];
- badLinksSecret: string[];
- badLinks: string[];
- badWords: BadWords;
- autoBanCode: string | null;
-}
-
-export interface SharedModelCreationAttributes {
- primaryKey?: 0;
- superUsers?: Snowflake[];
- privilegedUsers?: Snowflake[];
- badLinksSecret?: string[];
- badLinks?: string[];
- badWords?: BadWords;
- autoBanCode?: string;
-}
-
-export class Shared extends BaseModel<SharedModel, SharedModelCreationAttributes> implements SharedModel {
- /**
- * The primary key of the shared model.
- */
- public declare primaryKey: 0;
-
- /**
- * Trusted users.
- */
- public declare superUsers: Snowflake[];
-
- /**
- * Users that have all permissions that devs have except eval.
- */
- public declare privilegedUsers: Snowflake[];
-
- /**
- * Non-public bad links.
- */
- public declare badLinksSecret: string[];
-
- /**
- * Public Bad links.
- */
- public declare badLinks: string[];
-
- /**
- * Bad words.
- */
- public declare badWords: BadWords;
-
- /**
- * Code that is used to match for auto banning users in moulberry's bush
- */
- public declare autoBanCode: string;
-
- /**
- * Initializes the model.
- * @param sequelize The sequelize instance.
- */
- public static initModel(sequelize: Sequelize): void {
- Shared.init(
- {
- primaryKey: { type: DataTypes.INTEGER, primaryKey: true, validate: { min: 0, max: 0 } },
- superUsers: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- privilegedUsers: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- badLinksSecret: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- badLinks: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
- badWords: { type: DataTypes.JSONB, allowNull: false, defaultValue: {} },
- autoBanCode: { type: DataTypes.TEXT }
- },
- { sequelize, freezeTableName: true }
- );
- }
-}