{"action":"created","issue":{"url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/543","repository_url":"https://api.github.com/repos/mickhansen/graphql-sequelize","labels_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/543/labels{/name}","comments_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/543/comments","events_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/543/events","html_url":"https://github.com/mickhansen/graphql-sequelize/issues/543","id":275901044,"number":543,"title":"Example for a belongsTo is missing","user":{"login":"intellix","id":1162531,"avatar_url":"https://avatars3.githubusercontent.com/u/1162531?v=4","gravatar_id":"","url":"https://api.github.com/users/intellix","html_url":"https://github.com/intellix","followers_url":"https://api.github.com/users/intellix/followers","following_url":"https://api.github.com/users/intellix/following{/other_user}","gists_url":"https://api.github.com/users/intellix/gists{/gist_id}","starred_url":"https://api.github.com/users/intellix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intellix/subscriptions","organizations_url":"https://api.github.com/users/intellix/orgs","repos_url":"https://api.github.com/users/intellix/repos","events_url":"https://api.github.com/users/intellix/events{/privacy}","received_events_url":"https://api.github.com/users/intellix/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-22T00:01:04Z","updated_at":"2017-11-23T07:40:51Z","closed_at":"2017-11-23T07:40:51Z","author_association":"NONE","body":"Was gruelling over trying to do this as a fairly new user, but managed to do it in the end. Couldn't find any example of how this should be done since there's a fair bit of magic and it's not that clear what the library has for doing it. Seems in the end it was quite simple:\r\n\r\nExample for fetching a belongsTo like **task.user**:\r\n\r\n```ts\r\nlet taskType = new GraphQLObjectType({\r\n  name: 'Task',\r\n  description: 'A task',\r\n  fields: {\r\n    id: {\r\n      type: new GraphQLNonNull(GraphQLInt),\r\n      description: 'The id of the task.',\r\n    },\r\n    title: {\r\n      type: GraphQLString,\r\n      description: 'The title of the task.',\r\n    },\r\n    // Example missing\r\n    user: {\r\n      type: UserType,\r\n      resolve: async task => task.getUser(),\r\n    }\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/comments/346547957","html_url":"https://github.com/mickhansen/graphql-sequelize/issues/543#issuecomment-346547957","issue_url":"https://api.github.com/repos/mickhansen/graphql-sequelize/issues/543","id":346547957,"user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars3.githubusercontent.com/u/699049?v=4","gravatar_id":"","url":"https://api.github.com/users/mickhansen","html_url":"https://github.com/mickhansen","followers_url":"https://api.github.com/users/mickhansen/followers","following_url":"https://api.github.com/users/mickhansen/following{/other_user}","gists_url":"https://api.github.com/users/mickhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/mickhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickhansen/subscriptions","organizations_url":"https://api.github.com/users/mickhansen/orgs","repos_url":"https://api.github.com/users/mickhansen/repos","events_url":"https://api.github.com/users/mickhansen/events{/privacy}","received_events_url":"https://api.github.com/users/mickhansen/received_events","type":"User","site_admin":false},"created_at":"2017-11-23T07:40:51Z","updated_at":"2017-11-23T07:40:51Z","author_association":"OWNER","body":"Or: `resolve: resolver(Task.User)` if `Task.User` is an association"}}
{"actor":{"display_login":"mickhansen"}}