graphql-compose-mongoose icon indicating copy to clipboard operation
graphql-compose-mongoose copied to clipboard

custom fields only in createPayload, not in createInput ?

Open ISeekTruth opened this issue 8 years ago • 1 comments

CreatePayload:

image

CreateInput: image

Playground: image

const schema = createSchemaFields('User', {
    name: String,
    age: Number
})

console.log(schema.ModelTC.getType())
schema.ModelTC.addFields({
    phone: 'String',
    createdAt: 'String',
})

ISeekTruth avatar Dec 09 '17 07:12 ISeekTruth

The code above adds fields to the object type, but not to resolver input type. To add fields to the input args, modify the resolver args as follows:

ModelTC
  .getResolver('createOne')
  .getArgITC('record')
  .addFields({
    phone: 'String',
    createdAt: 'String',
  })

oklas avatar Jun 11 '21 19:06 oklas