diff options
author | TymanWasTaken <tyman@tyman.tech> | 2021-05-16 21:40:52 -0400 |
---|---|---|
committer | TymanWasTaken <tyman@tyman.tech> | 2021-05-16 21:40:52 -0400 |
commit | 284e1d1d693486f6c50cdb8b38f01cdf74eb63d2 (patch) | |
tree | 1c05e9bb592018f82302688180e87b4bf1305ca5 /src/lib/models/Level.ts | |
parent | 372718e567e060cead16dde5d6d190666b4dd575 (diff) | |
download | tanzanite-284e1d1d693486f6c50cdb8b38f01cdf74eb63d2.tar.gz tanzanite-284e1d1d693486f6c50cdb8b38f01cdf74eb63d2.tar.bz2 tanzanite-284e1d1d693486f6c50cdb8b38f01cdf74eb63d2.zip |
fix logging for slash command syncing, rename a few files
Diffstat (limited to 'src/lib/models/Level.ts')
-rw-r--r-- | src/lib/models/Level.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index f08f29b..426ec1a 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -1,3 +1,4 @@ +import { DataTypes, Sequelize } from 'sequelize'; import { BaseModel } from './BaseModel'; export interface LevelModel { @@ -16,6 +17,24 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> { get level(): number { return Level.convertXpToLevel(this.xp); } + + static initModel(sequelize: Sequelize): void { + Level.init( + { + id: { + type: DataTypes.STRING, + primaryKey: true, + allowNull: false + }, + xp: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: 0 + } + }, + { sequelize: sequelize } + ); + } static convertXpToLevel(xp: number): number { let i = 1; let lvl: number; |