From 81326aa1dc5c930798f8aaaf03846bae0139afea Mon Sep 17 00:00:00 2001 From: L4168 <L4168@student.jamk.fi> Date: Thu, 11 Jul 2019 16:06:29 +0300 Subject: [PATCH] add Interceptor --- src/score/score.controller.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/score/score.controller.ts b/src/score/score.controller.ts index 2fdebd9..dd26dd2 100644 --- a/src/score/score.controller.ts +++ b/src/score/score.controller.ts @@ -1,4 +1,13 @@ -import { Controller, Post, UsePipes, Body, Param, Get } from '@nestjs/common'; +import { + Controller, + Post, + UsePipes, + Body, + Param, + Get, + UseInterceptors, + ClassSerializerInterceptor, +} from '@nestjs/common'; import { ValidationPipe } from '../shared/validation.pipe'; import { ScoreService } from './score.service'; @@ -29,6 +38,7 @@ export class ScoreController { // shows scores, :id is gameId @Get('get-score/:id') + @UseInterceptors(ClassSerializerInterceptor) @GameStates('STARTED') async getScores(@Param('id') gameId: GameEntity) { return this.scoreService.getScores(gameId); -- GitLab