prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

Fields missing in "input" if there is a relation

Open apss-pohl opened this issue 2 years ago • 4 comments
trafficstars

I am missing fields if there is a relation based on those. E.g.:

model customerTest {
  id               Int       @id @default(autoincrement()) @db.UnsignedInt
  /// @Validator.IsInt()
  posId            Int       @db.UnsignedTinyInt

  posRelation     posSettings    @relation(fields: [posId], references: [id])
}

Will result in "customer-test-create.input.ts":

import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { posSettingsCreateNestedOneWithoutCustomerTestInput } from '../../pos-settings/inputs/pos-settings-create-nested-one-without-customer-test.input';
import { Type } from 'class-transformer';

@InputType()
export class customerTestCreateInput {

    @Field(() => posSettingsCreateNestedOneWithoutCustomerTestInput, {nullable:false})
    @Type(() => posSettingsCreateNestedOneWithoutCustomerTestInput)
    posRelation!: posSettingsCreateNestedOneWithoutCustomerTestInput;
}

Which makes it impossible to set the "posId" directly.

apss-pohl avatar Jan 13 '23 16:01 apss-pohl