Add configurable levels
- Add Level table and gql type - change level field on User - add hook on user to update the levelpull/4/head
parent
781ee274b8
commit
9328367bb5
@ -0,0 +1,33 @@
|
|||||||
|
import * as sqz from "sequelize";
|
||||||
|
import {Column, Model, NotNull, Table, Unique} from "sequelize-typescript";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A level of the ranking system
|
||||||
|
*/
|
||||||
|
@Table({underscored: true})
|
||||||
|
export class Level extends Model<Level> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the level
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@Unique
|
||||||
|
@Column({allowNull: false, type: sqz.STRING(64), unique: true})
|
||||||
|
public name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of the level
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@Unique
|
||||||
|
@Column({allowNull: false, unique: true})
|
||||||
|
public levelNumber: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The required points for the level
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@Unique
|
||||||
|
@Column({allowNull: false, unique: true})
|
||||||
|
public points: number;
|
||||||
|
}
|
Loading…
Reference in New Issue