Skip to content

Commit

Permalink
fix(sample): id param is string type
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed May 18, 2022
1 parent 1e56057 commit 477303b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 477303b

Please sign in to comment.