添加数据库类型别名
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop } from '@typegoose/typegoose';
|
||||
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
|
||||
|
||||
/**
|
||||
* 战斗记录接口
|
||||
@@ -23,14 +23,16 @@ export default class BattleSweepRecord extends BaseModel {
|
||||
count: number; // 扫荡次数
|
||||
|
||||
public static async saveBattleSweepRecordById(roleId: string, battleId: number, params: any, lean = true) {
|
||||
const result = await BattleSweepRecordModel.findOneAndUpdate({ roleId, battleId }, params, {new: true, upsert: true}).lean(lean);
|
||||
const result: BattleSweepRecordType = await BattleSweepRecordModel.findOneAndUpdate({ roleId, battleId }, params, {new: true, upsert: true}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async deleteAccount(roleId: string, lean = true) {
|
||||
let result = await BattleSweepRecordModel.deleteMany({roleId}).lean(lean);
|
||||
return result||{};
|
||||
public static async deleteAccount(roleId: string) {
|
||||
let result = await BattleSweepRecordModel.deleteMany({roleId});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const BattleSweepRecordModel = getModelForClass(BattleSweepRecord);
|
||||
|
||||
export interface BattleSweepRecordType extends Pick<DocumentType<BattleSweepRecord>, keyof BattleSweepRecord>{}
|
||||
|
||||
Reference in New Issue
Block a user