Skip to content

Commit

Permalink
refactor!: Make create DTO field types non nullable all the time
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The autogenerated Create graphql type now will have non nullable fields for non nullable fields of the DTO
  • Loading branch information
ValentinVignal committed Jan 22, 2023
1 parent d73a482 commit 71799ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/query-graphql/src/resolvers/create.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @packageDocumentation
*/
// eslint-disable-next-line max-classes-per-file
import { Args, ArgsType, InputType, PartialType, Resolver } from '@nestjs/graphql'
import { Args, ArgsType, InputType, OmitType, Resolver } from '@nestjs/graphql'
import { Class, DeepPartial, Filter, QueryService } from '@ptc-org/nestjs-query-core'
import omit from 'lodash.omit'

Expand Down Expand Up @@ -56,9 +56,9 @@ const defaultCreateDTO = <DTO, C>(dtoNames: DTONames, DTOClass: Class<DTO>): Cla
@InputType(`Create${dtoNames.baseName}`)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
class PartialInput extends PartialType(DTOClass, InputType) {}
class CreateInput extends OmitType(DTOClass, [], InputType) {}

return PartialInput as Class<C>
return CreateInput as Class<C>
}

/** @internal */
Expand Down

0 comments on commit 71799ef

Please sign in to comment.