import { Args , Mutation , Resolver } from '@nestjs/graphql' ; import { Query } from '@nestjs/graphql' ; import { CatService } from './cat.service' ; import { CatInput } from './models/cat-input.dto' ; import { CatInsert } from './models/cat-mutation.dto' ; import { Cat } from './models/cat-query.dto' ; @ Resolver ( ( ) => Cat ) export class CatResolver { constructor ( private readonly catService ) { } @ Query ( ( ) => [ Cat ] ) getCats ( ) { return this . catService . getCats ( ) ; } @ Query ( ( ) => Cat ) getCat ( @ Args ( 'catId' ) args ) { return this . catService . getOneCat ( args ) ; } @ Mutation ( ( ) => Cat ) insertCat ( @ Args ( 'newCat' ) newCat ) { return this . catService . newCat ( newCat ) ; } }