{"action":"created","issue":{"url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/64","labels_url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/64/comments","events_url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/64/events","html_url":"https://github.com/RisingStack/graffiti-mongoose/issues/64","id":118343795,"number":64,"title":"Extending grafitti schema","user":{"login":"zuhair-naqvi","id":262722,"avatar_url":"https://avatars.githubusercontent.com/u/262722?v=3","gravatar_id":"","url":"https://api.github.com/users/zuhair-naqvi","html_url":"https://github.com/zuhair-naqvi","followers_url":"https://api.github.com/users/zuhair-naqvi/followers","following_url":"https://api.github.com/users/zuhair-naqvi/following{/other_user}","gists_url":"https://api.github.com/users/zuhair-naqvi/gists{/gist_id}","starred_url":"https://api.github.com/users/zuhair-naqvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuhair-naqvi/subscriptions","organizations_url":"https://api.github.com/users/zuhair-naqvi/orgs","repos_url":"https://api.github.com/users/zuhair-naqvi/repos","events_url":"https://api.github.com/users/zuhair-naqvi/events{/privacy}","received_events_url":"https://api.github.com/users/zuhair-naqvi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-23T09:22:20Z","updated_at":"2015-11-25T21:17:07Z","closed_at":null,"body":"getSchema returns a GraphQLSchema object based on MongooseModels, how do I go about adding my own types to this schema?\r\n\r\nConsider the use case:\r\nI have a `Post` object with `getLikedFriends` method, which looks up all `Post.likes` references and queries `Users` collection to check if any of the `User.friends` references for the loggedIn user match with `Post.likes`\r\n\r\nSo instead of creating a new Mongoose model and re-implementing the logic inside my pre-existing `getLikedFriends` method, I'd like to just add this as a new type to the GraphQL schema and let the resolve function call `Post.getLikedFriends(ctx.loggedInUser)`\r\n\r\nThis is something I can easily do using vanilla GraphQL but not sure how to augment the schema returned by graffiti :/"},"comment":{"url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/comments/159733312","html_url":"https://github.com/RisingStack/graffiti-mongoose/issues/64#issuecomment-159733312","issue_url":"https://api.github.com/repos/RisingStack/graffiti-mongoose/issues/64","id":159733312,"user":{"login":"tothandras","id":4157749,"avatar_url":"https://avatars.githubusercontent.com/u/4157749?v=3","gravatar_id":"","url":"https://api.github.com/users/tothandras","html_url":"https://github.com/tothandras","followers_url":"https://api.github.com/users/tothandras/followers","following_url":"https://api.github.com/users/tothandras/following{/other_user}","gists_url":"https://api.github.com/users/tothandras/gists{/gist_id}","starred_url":"https://api.github.com/users/tothandras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tothandras/subscriptions","organizations_url":"https://api.github.com/users/tothandras/orgs","repos_url":"https://api.github.com/users/tothandras/repos","events_url":"https://api.github.com/users/tothandras/events{/privacy}","received_events_url":"https://api.github.com/users/tothandras/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T21:17:07Z","updated_at":"2015-11-25T21:17:07Z","body":"@zuhair-naqvi I am open to changes! First, we definitely need to split up this project into 2. Migrate out the non Mongoose specific parts into an independent library, that would make creating new adapters easier and we could take advantage of the graffiti model too. I will be really busy in the next few weeks though (finishing school), I am happy to see PRs and following suggestions!"}}