Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
User commands in mage-validator
import * as mage from 'mage'
import { Acl } from 'mage-validator'
import { IsInt, Max, ValidateNested } from 'class-validator';
import PlayerData from '../types/PlayerData'
export default class {
@IsInt()
@Min(1)
public gemRegisterBonus: number
@ValidateNested()
public data: PlayerData
@Acl('*')
public static async execute(state: mage.core.IState, data: PlayerData, gemRegisterBonus: number) {
data.gems += gemRegisterBonus
return data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment