Brakebein / prisma-generator-nestjs-dto

Generates NestJS DTO classes from Prisma Schema
Apache License 2.0
48 stars 26 forks source link

Enum Handling in DTO #46

Closed dwcahyo23 closed 2 months ago

dwcahyo23 commented 2 months ago
enum Status {
    Y
    N
    C
}

  /// @description WO VERIFY
  /// @IsNotEmpty()
  repClosed   Status @default(value: N)

Enum hidden in createDto / updateDto in v1.23.1

Brakebein commented 2 months ago

It's hidden because it has a default value. You need to add the /// @DtoCreateOptional and /// @DtoUpdateOptional annotations to include it in the CreateDto and UpdateDto (should be independent of the type).

See last point of the conditions when a field is omitted: Readme - CreateDto