neumino / thinky

JavaScript ORM for RethinkDB
http://justonepixel.com/thinky/
Other
1.12k stars 128 forks source link

new model with object as args ? #611

Closed smolleyes closed 7 years ago

smolleyes commented 7 years ago

hi

first, it s very sad that this lib is not maintained anymore but thanks for all your work :) wish someone will continue this project...

i m learning graphql now and still can use my thinky models...

just a question

why can t i do something like this

const ClientsTypesInputSchema = new GraphQLObjectType({
    name: 'ClientsTypesInputSchema',
    fields: {
      create: {
        type: ClientType,
        description: 'Create a new client type in the database',
        args: {
          input: { type: ClientTypeInput }
        },
        resolve: (root, { input }) => {
          const newType = new models.clientsTypes(input); // input = {name: 'test'}
          return newType.save();
        }
      }
    }
});

i don t understand why if i write myself, models.clientsTypes({ name: 'test' }); it works but not with my "input" object wich is the same thing finally ... Oo ?

thanks!