寻宝解散队伍

This commit is contained in:
liangtongchuan
2020-11-22 09:24:35 +08:00
parent 365aa385b8
commit dd9ea0dd35
3 changed files with 31 additions and 4 deletions

View File

@@ -75,12 +75,17 @@ export default class ComBattleTeam extends BaseModel {
}
public static async addRole(teamCode: string, roleStatus: RoleStatus, lean = true) {
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamCode }, {$push: {roleIds: roleStatus.roleId, roleStatus}}, {upsert: true, new: true}).lean(lean);
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode }, {$push: {roleIds: roleStatus.roleId, roleStatus}}, {upsert: true, new: true}).lean(lean);
return team;
}
public static async removeRole(teamCode: string, roleIdToRm: string, lean = true) {
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamCode }, {$pull: {roleIds: roleIdToRm, roleStatus: {roleId: roleIdToRm}}}, {new: true}).lean(lean);
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode }, {$pull: {roleIds: roleIdToRm, roleStatus: {roleId: roleIdToRm}}}, {new: true}).lean(lean);
return team;
}
public static async removeTeam(teamCode: string, lean = true) {
const team = await ComBattleTeamModel.findOneAndDelete({ teamCode }).lean(lean);
return team;
}