aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/Ban.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-23 22:02:44 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-23 22:02:44 -0400
commitb015bec7f66526ec5e959ae99865845f4db4b181 (patch)
tree67538c9549b7e0f7cd6a97e9c82db8d8462a19c7 /src/lib/models/Ban.ts
parent5c242f597595b8db71875d92c0afe0a5947442a6 (diff)
downloadtanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.tar.gz
tanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.tar.bz2
tanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.zip
feat: some shit
- fix breaking changes - refactored active punishments into one table - made listeners args have stricter types
Diffstat (limited to 'src/lib/models/Ban.ts')
-rw-r--r--src/lib/models/Ban.ts80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/lib/models/Ban.ts b/src/lib/models/Ban.ts
deleted file mode 100644
index 1bdda6f..0000000
--- a/src/lib/models/Ban.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { Snowflake } from 'discord.js';
-import { DataTypes, Sequelize } from 'sequelize';
-import { v4 as uuidv4 } from 'uuid';
-import { BaseModel } from './BaseModel';
-
-export interface BanModel {
- id: string;
- user: Snowflake;
- guild: Snowflake;
- expires: Date;
- modlog: string;
-}
-export interface BanModelCreationAttributes {
- id?: string;
- user: Snowflake;
- guild: Snowflake;
- expires?: Date;
- modlog: string;
-}
-
-export class Ban extends BaseModel<BanModel, BanModelCreationAttributes> implements BanModel {
- /**
- * The ID of this ban (no real use just for a primary key)
- */
- id: string;
- /**
- * The user who is banned
- */
- user: Snowflake;
- /**
- * The guild they are banned from
- */
- guild: Snowflake;
- /**
- * The date at which this ban expires and should be unbanned (optional)
- */
- expires: Date | null;
- /**
- * The ref to the modlog entry
- */
- modlog: string;
-
- static initModel(sequelize: Sequelize): void {
- Ban.init(
- {
- id: {
- type: DataTypes.STRING,
- primaryKey: true,
- allowNull: false,
- defaultValue: uuidv4
- },
- user: {
- type: DataTypes.STRING,
- allowNull: false
- },
- guild: {
- type: DataTypes.STRING,
- allowNull: false,
- references: {
- model: 'Guilds',
- key: 'id'
- }
- },
- expires: {
- type: DataTypes.DATE,
- allowNull: true
- },
- modlog: {
- type: DataTypes.STRING,
- allowNull: false,
- references: {
- model: 'ModLogs',
- key: 'id'
- }
- }
- },
- { sequelize: sequelize }
- );
- }
-}