From 6f90e0abcfefc59447c0256000fb948c51c4f0e5 Mon Sep 17 00:00:00 2001 From: L4168 <L4168@student.jamk.fi> Date: Tue, 2 Jul 2019 07:59:10 +0300 Subject: [PATCH] added Interceptors --- src/faction/faction.controller.ts | 3 +++ src/game/game.controller.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/faction/faction.controller.ts b/src/faction/faction.controller.ts index 28552e9..dec9308 100644 --- a/src/faction/faction.controller.ts +++ b/src/faction/faction.controller.ts @@ -7,6 +7,8 @@ import { Body, Get, Put, + UseInterceptors, + ClassSerializerInterceptor, } from '@nestjs/common'; import { AuthGuard } from '../shared/auth.guard'; @@ -56,6 +58,7 @@ export class FactionController { return this.factionservice.joinGroup(person, id, data); } + @UseInterceptors(ClassSerializerInterceptor) @Get('get-faction-members/:id') async getFactionMembers(@Param('id') factionId) { return this.factionservice.listFactionMembers(factionId); diff --git a/src/game/game.controller.ts b/src/game/game.controller.ts index 3c6d003..a97155c 100644 --- a/src/game/game.controller.ts +++ b/src/game/game.controller.ts @@ -7,6 +7,8 @@ import { Param, UsePipes, Put, + UseInterceptors, + ClassSerializerInterceptor, } from '@nestjs/common'; import { GameService } from './game.service'; @@ -39,6 +41,8 @@ export class GameController { return this.gameservice.listGames(); } + // ClassSerializerInterceptor removes excluded columns set in Entities + @UseInterceptors(ClassSerializerInterceptor) @Get(':id') async returnGameInfo(@Param('id') id: string) { return this.gameservice.returnGameInfo(id); -- GitLab