diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-01 15:40:31 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-01 15:40:31 -0400 |
commit | 13894f2beffc776a56ac03868613b4313dfb57bf (patch) | |
tree | 028c229b42c2a74a3c511386f594385d3ed77dd5 /src/lib/models | |
parent | 914c4d3cb7f02a0c74b677e67a47fb66a65fb724 (diff) | |
download | tanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.tar.gz tanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.tar.bz2 tanzanite-13894f2beffc776a56ac03868613b4313dfb57bf.zip |
convert to esm
Diffstat (limited to 'src/lib/models')
-rw-r--r-- | src/lib/models/ActivePunishment.ts | 7 | ||||
-rw-r--r-- | src/lib/models/BaseModel.ts | 2 | ||||
-rw-r--r-- | src/lib/models/Global.ts | 8 | ||||
-rw-r--r-- | src/lib/models/Guild.ts | 14 | ||||
-rw-r--r-- | src/lib/models/Level.ts | 6 | ||||
-rw-r--r-- | src/lib/models/ModLog.ts | 8 | ||||
-rw-r--r-- | src/lib/models/Stat.ts | 8 | ||||
-rw-r--r-- | src/lib/models/StickyRole.ts | 8 | ||||
-rw-r--r-- | src/lib/models/__helpers.ts | 5 |
9 files changed, 42 insertions, 24 deletions
diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index 83ada29..23dd33b 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -1,7 +1,10 @@ import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; + +const { DataTypes } = (await import('sequelize')).default + export enum ActivePunishmentType { BAN = 'BAN', diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts index 8fba5e5..e503317 100644 --- a/src/lib/models/BaseModel.ts +++ b/src/lib/models/BaseModel.ts @@ -1,4 +1,4 @@ -import { Model } from 'sequelize'; +const { Model } = (await import('sequelize')).default; export abstract class BaseModel<A, B> extends Model<A, B> { /** diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index 6b6ebae..b096c7f 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -1,7 +1,9 @@ import { type Snowflake } from 'discord.js'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; -import { jsonArray } from './__helpers'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; +import { jsonArray } from './__helpers.js'; + +const { DataTypes } = (await import('sequelize')).default export interface GlobalModel { environment: 'production' | 'development' | 'beta'; diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 583cbd7..78be846 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -1,9 +1,11 @@ import { type Snowflake } from 'discord.js'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { type BadWords } from '../common/AutoMod'; -import { type BushClient } from '../extensions/discord-akairo/BushClient'; -import { BaseModel } from './BaseModel'; -import { jsonArray, jsonObject } from './__helpers'; +import { type Sequelize } from 'sequelize'; +import { type BadWords } from '../common/AutoMod.js'; +import { type BushClient } from '../extensions/discord-akairo/BushClient.js'; +import { BaseModel } from './BaseModel.js'; +import { jsonArray, jsonObject } from './__helpers.js'; + +const { DataTypes } = (await import('sequelize')).default export interface GuildModel { id: Snowflake; @@ -160,7 +162,7 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i levelRoles: jsonObject('levelRoles'), levelUpChannel: { type: DataTypes.STRING, allowNull: true } }, - { sequelize: sequelize } + { sequelize } ); } } diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index 6499bff..f1083fc 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -1,6 +1,8 @@ import { type Snowflake } from 'discord.js'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; + +const { DataTypes } = (await import('sequelize')).default export interface LevelModel { user: Snowflake; diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index b2351b9..757ee66 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -1,8 +1,10 @@ import { type Snowflake } from 'discord.js'; import { nanoid } from 'nanoid'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; -import { jsonBoolean } from './__helpers'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; +import { jsonBoolean } from './__helpers.js'; + +const { DataTypes } = (await import('sequelize')).default export enum ModLogType { PERM_BAN = 'PERM_BAN', diff --git a/src/lib/models/Stat.ts b/src/lib/models/Stat.ts index a6e8f19..c5f02b8 100644 --- a/src/lib/models/Stat.ts +++ b/src/lib/models/Stat.ts @@ -1,6 +1,8 @@ -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; -import { jsonBigint } from './__helpers'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; +import { jsonBigint } from './__helpers.js'; + +const { DataTypes } = (await import('sequelize')).default type Environment = 'production' | 'development' | 'beta'; diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index 657bac6..a6f604d 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -1,7 +1,9 @@ import { type Snowflake } from 'discord.js'; -import { DataTypes, type Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; -import { jsonArray } from './__helpers'; +import { type Sequelize } from 'sequelize'; +import { BaseModel } from './BaseModel.js'; +import { jsonArray } from './__helpers.js'; + +const { DataTypes } = (await import('sequelize')).default export interface StickyRoleModel { user: Snowflake; diff --git a/src/lib/models/__helpers.ts b/src/lib/models/__helpers.ts index 3a958b9..3b7f4a4 100644 --- a/src/lib/models/__helpers.ts +++ b/src/lib/models/__helpers.ts @@ -1,4 +1,7 @@ -import { DataTypes, type Model } from 'sequelize'; +import { type Model } from 'sequelize'; + +const { DataTypes } = (await import('sequelize')).default + export function jsonParseGet(this: Model, key: string): any { return JSON.parse(this.getDataValue(key)); |