title: GraphQL endpoint return null object in Nest.js
body: <p>I'm using Nest.js and Sequelize-Typescript to build a GraphQL API.</p>
  
  <p>When I called delete and update mutations I got a null object, but the operation it is done. I need to put {nullable: true} because I got a error saying <code>Cannot return null for non-nullable field</code> . How I fix it? I need the endpoint to return the updated object to show the information on the front</p>
  
  <p><a href="https://i.stack.imgur.com/AtARe.png" rel="nofollow noreferrer">error img</a></p>
  
  <p><em>book.dto.ts</em></p>
  
  <pre><code>import { ObjectType, Field, Int, ID } from 'type-graphql';
  
  @ObjectType()
  export class BookType {
      @Field(() =&gt; ID, {nullable: true})
      readonly id: number;
      @Field({nullable: true})
      readonly title: string;
      @Field({nullable: true})
      readonly author: string;
  }
  
  </code></pre>
  
  <p><em>book.resolver.ts</em></p>
  
  <pre><code>import {Args, Mutation, Query, Resolver} from '@nestjs/graphql';
  import { Book } from './model/book.entity';
  import { BookType } from './dto/book.dto';
  import { CreateBookInput } from './input/createBook.input';
  import { UpdateBookInput } from './input/updateBook.input';
  import { BookService } from './book.service';
  
  @Resolver('Book')
  export class BookResolver {
      constructor(private readonly bookService: BookService) {}
  
      @Query(() =&gt; [BookType])
      async getAll(): Promise&lt;BookType[]&gt; {
          return await this.bookService.findAll();
      }
  
      @Query(() =&gt; BookType)
      async getOne(@Args('id') id: number) {
          return await this.bookService.find(id);
      }
  
      @Mutation(() =&gt; BookType)
      async createItem(@Args('input') input: CreateBookInput): Promise&lt;Book&gt; {
          const book = new Book();
          book.author = input.author;
          book.title = input.title;
          return await this.bookService.create(book);
      }
  
      @Mutation(() =&gt; BookType)
      async updateItem(
          @Args('input') input: UpdateBookInput): Promise&lt;[number, Book[]]&gt; {
          return await this.bookService.update(input);
      }
  
      @Mutation(() =&gt; BookType)
      async deleteItem(@Args('id') id: number) {
          return await this.bookService.delete(id);
      }
  
      @Query(() =&gt; String)
      async hello() {
          return 'hello';
      }
  }
  
  </code></pre>
  
  <p><em>book.service.ts</em></p>
  
  <pre><code>import {Inject, Injectable} from '@nestjs/common';
  import {InjectRepository} from '@nestjs/typeorm';
  import {Book} from './model/book.entity';
  import {DeleteResult, InsertResult, Repository, UpdateResult} from 'typeorm';
  
  @Injectable()
  export class BookService {
      constructor(@Inject('BOOKS_REPOSITORY') private readonly bookRepository: typeof Book) {}
  
      findAll(): Promise&lt;Book[]&gt; {
          return this.bookRepository.findAll&lt;Book&gt;();
      }
  
      find(id): Promise&lt;Book&gt; {
         return this.bookRepository.findOne({where: {id}});
      }
  
      create(data): Promise&lt;Book&gt; {
          return data.save();
      }
  
      update(data): Promise&lt;[number, Book[]]&gt; {
          return this.bookRepository.update&lt;Book&gt;(data, { where: {id: data.id} });
      }
  
      delete(id): Promise&lt;number&gt; {
          return this.bookRepository.destroy({where: {id}});
      }
  }
  
  </code></pre>