task-svr/src/models/InGameStats.ts
2024-05-11 10:35:33 +08:00

25 lines
749 B
TypeScript

import { dbconn } from 'decorators/dbconn'
import { getModelForClass, index, modelOptions, mongoose, prop } from '@typegoose/typegoose'
import { Severity } from '@typegoose/typegoose/lib/internal/constants'
import { BaseModule } from './Base'
/**
* 用户游戏内数据
*/
@dbconn()
@index({ user: 1 }, { unique: true })
@modelOptions({
schemaOptions: { collection: 'ingame_stats', timestamps: true },
})
export class InGameStatsClass extends BaseModule {
@prop()
public user: string
// 游戏内抽奖次数
@prop({ default: 0 })
public ticket: number
// 游戏内积分
@prop({ default: 0 })
public score: number
}
export const InGameStats = getModelForClass(InGameStatsClass, { existingConnection: InGameStatsClass['db'] })