31 lines
980 B
TypeScript
31 lines
980 B
TypeScript
import {
|
|
Controller,
|
|
Param,
|
|
ParseIntPipe,
|
|
Post,
|
|
} from '@nestjs/common';
|
|
import mongoose from 'mongoose';
|
|
import { AllowPublicAccess } from '../auth/allow-public-access.decorator';
|
|
import { ParseObjectIdPipe } from '../common/parse-object-id.pipe';
|
|
import { TournamentCodeService } from './tournament-code.service';
|
|
|
|
@Controller('communities/:communityId/tournament-codes')
|
|
export class TournamentCodeReplacementController {
|
|
constructor(private readonly tournamentCodeService: TournamentCodeService) {}
|
|
|
|
@Post('matches/:matchId/games/:gameNumber/replace')
|
|
@AllowPublicAccess()
|
|
public async replaceForMatchGame(
|
|
@Param('communityId', ParseObjectIdPipe)
|
|
communityId: mongoose.Types.ObjectId,
|
|
@Param('matchId', ParseObjectIdPipe) matchId: mongoose.Types.ObjectId,
|
|
@Param('gameNumber', ParseIntPipe) gameNumber: number,
|
|
) {
|
|
return this.tournamentCodeService.replaceForMatchGame({
|
|
communityId,
|
|
matchId,
|
|
gameNumber,
|
|
});
|
|
}
|
|
}
|