aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/Level.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/models/Level.ts')
-rw-r--r--src/lib/models/Level.ts19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts
index b834992..755b1c6 100644
--- a/src/lib/models/Level.ts
+++ b/src/lib/models/Level.ts
@@ -3,12 +3,14 @@ import { DataTypes, Sequelize } from 'sequelize';
import { BaseModel } from './BaseModel';
export interface LevelModel {
- id: Snowflake;
+ user: Snowflake;
+ guild: Snowflake;
xp: number;
}
export interface LevelModelCreationAttributes {
- id: Snowflake;
+ user: Snowflake;
+ guild: Snowflake;
xp?: number;
}
@@ -16,7 +18,11 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> {
/**
* The user's id.
*/
- public id: Snowflake;
+ public user: Snowflake;
+ /**
+ * The guild where the user is gaining xp.
+ */
+ public guild: Snowflake;
/**
* The user's xp.
*/
@@ -28,9 +34,12 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> {
static initModel(sequelize: Sequelize): void {
Level.init(
{
- id: {
+ user: {
+ type: DataTypes.STRING,
+ allowNull: false
+ },
+ guild: {
type: DataTypes.STRING,
- primaryKey: true,
allowNull: false
},
xp: {