fix: allow public tournament code replacement
This commit is contained in:
1 parent
303886ed53
commit
b9881fcb6f
7 files changed
+117
-27
No files matched your search
@@ -274,13 +274,17 @@ export class TournamentCodeService {
|
||||
}
|
||||
|
||||
public async replaceForMatchGame(params: {
|
||||
communityId: mongoose.Types.ObjectId;
|
||||
matchId: mongoose.Types.ObjectId;
|
||||
gameNumber: number;
|
||||
}): Promise<TournamentCodeSlotView> {
|
||||
const MatchModel = await this.connectionService.getModel('match');
|
||||
const TournamentCodeModel =
|
||||
await this.connectionService.getModel('tournamentCode');
|
||||
const match = await MatchModel.findById(params.matchId).exec();
|
||||
const match = await MatchModel.findOne({
|
||||
_id: params.matchId,
|
||||
communityId: params.communityId,
|
||||
}).exec();
|
||||
if (!match) throw new NotFoundException('Match not found.');
|
||||
if (match.status !== 'team-built' && match.status !== 'in-progress') {
|
||||
throw new BadRequestException(
|
||||
|
||||
Reference in new issue
Block a user