Skip to content

Commit

Permalink
Merge pull request #9597 from yiminghe/fix-number
Browse files Browse the repository at this point in the history
fix(sample): id param is string type
  • Loading branch information
kamilmysliwiec authored May 31, 2022
2 parents 6b38ce1 + 477303b commit 404efbb
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 404efbb

Please sign in to comment.