48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { dbconn } from 'decorators/dbconn'
|
|
import { getModelForClass, index, modelOptions, prop, mongoose } from '@typegoose/typegoose'
|
|
import { BaseModule } from './Base'
|
|
|
|
|
|
|
|
export enum CECStatusEnum {
|
|
NORMAL = 1,
|
|
CLAIMED = 9,
|
|
}
|
|
/**
|
|
* CEC赚取记录
|
|
*/
|
|
@dbconn()
|
|
@index({ address: 1 }, { unique: false })
|
|
@modelOptions({
|
|
schemaOptions: { collection: 'cec_earn_record', timestamps: true },
|
|
})
|
|
class CECRecordClass extends BaseModule {
|
|
@prop()
|
|
public address: string
|
|
|
|
@prop({ set: (val: bigint | BigInt | String | Number) => val.toString(), get: (val: string) => BigInt(val)})
|
|
public amount: bigint
|
|
|
|
@prop()
|
|
public earnTime: string
|
|
|
|
@prop()
|
|
public desc: string
|
|
|
|
@prop()
|
|
public firstRate: number
|
|
|
|
@prop({ enum: CECStatusEnum, default: CECStatusEnum.NORMAL })
|
|
public status: CECStatusEnum
|
|
|
|
public toJson() {
|
|
return {
|
|
address: this.address,
|
|
amount: this.amount.toString(),
|
|
desc: this.desc,
|
|
earnTime: this.earnTime
|
|
}
|
|
}
|
|
}
|
|
export const CECRecord = getModelForClass(CECRecordClass, { existingConnection: CECRecordClass['db'] })
|