From 477303b058243c93bc1dcea7cdc695ae54df62c4 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Wed, 18 May 2022 17:45:25 +0800 Subject: [PATCH] fix(sample): id param is string type --- .../posts-application/src/posts/posts.resolver.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sample/31-graphql-federation-code-first/posts-application/src/posts/posts.resolver.ts b/sample/31-graphql-federation-code-first/posts-application/src/posts/posts.resolver.ts index 891f1398aac..c66f8dc38a0 100644 --- a/sample/31-graphql-federation-code-first/posts-application/src/posts/posts.resolver.ts +++ b/sample/31-graphql-federation-code-first/posts-application/src/posts/posts.resolver.ts @@ -9,13 +9,14 @@ import { import { Post } from './models/post.model'; import { User } from './models/user.model'; import { PostsService } from './posts.service'; +import { ParseIntPipe } from '@nestjs/common'; @Resolver((of) => Post) export class PostsResolver { constructor(private readonly postsService: PostsService) {} @Query((returns) => Post) - post(@Args({ name: 'id', type: () => ID }) id: number): Post { + post(@Args({ name: 'id', type: () => ID }, ParseIntPipe) id: number): Post { return this.postsService.findOne(id); }