{"action":"created","issue":{"url":"https://api.github.com/repos/aerogear/data-sync-server/issues/22","repository_url":"https://api.github.com/repos/aerogear/data-sync-server","labels_url":"https://api.github.com/repos/aerogear/data-sync-server/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/aerogear/data-sync-server/issues/22/comments","events_url":"https://api.github.com/repos/aerogear/data-sync-server/issues/22/events","html_url":"https://github.com/aerogear/data-sync-server/pull/22","id":340553896,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwOTM2MjQy","number":22,"title":"Memeolist proper","user":{"login":"aliok","id":376732,"node_id":"MDQ6VXNlcjM3NjczMg==","avatar_url":"https://avatars2.githubusercontent.com/u/376732?v=4","gravatar_id":"","url":"https://api.github.com/users/aliok","html_url":"https://github.com/aliok","followers_url":"https://api.github.com/users/aliok/followers","following_url":"https://api.github.com/users/aliok/following{/other_user}","gists_url":"https://api.github.com/users/aliok/gists{/gist_id}","starred_url":"https://api.github.com/users/aliok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aliok/subscriptions","organizations_url":"https://api.github.com/users/aliok/orgs","repos_url":"https://api.github.com/users/aliok/repos","events_url":"https://api.github.com/users/aliok/events{/privacy}","received_events_url":"https://api.github.com/users/aliok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-07-12T09:14:23Z","updated_at":"2018-07-24T13:19:28Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/aerogear/data-sync-server/pulls/22","html_url":"https://github.com/aerogear/data-sync-server/pull/22","diff_url":"https://github.com/aerogear/data-sync-server/pull/22.diff","patch_url":"https://github.com/aerogear/data-sync-server/pull/22.patch"},"body":"This PR is about trying out the Memeolist schema on our sync server as per https://issues.jboss.org/browse/AEROGEAR-3441\r\n\r\nThis is the schema defined in the proposal: https://github.com/secondsun/proposals/blob/eb4bc07e472f9a96ee1d69c491f772ecb484eabb/dogfood.md#sample-schema\r\n\r\nTrying out a real world example as a user helps with finding bugs and limitations.\r\nI didn't just put the whole schema and then try to write resolvers. I am going step by step.\r\n\r\nHere are the issues found so far:\r\n* NeDB uses `_id` as the id field name. This causes portability issues such as a schema itself needs to be updated when switching the data source. Ideally, only the resolvers should've changed, not the schema.\r\nAs a solution to that, I implemented a 'convertNeDBIds' Handlebars helper that would convert `_id`s to `id`s. With this change, types in schemas can still use `id` as the id field.\r\n\r\n* NeDB doesn't have an option to return the deleted docs. It only returns the number of deleted docs. So, the delete query definitions should be changed to return a number (num deleted) or boolean (if something is deleted).\r\nI have also implemented a `toBoolean` helper to use in resolvers that could be useful in this case.\r\n\r\n* In NeDB unlike queries and inserts, update operation's callback have a different signature. Needed to adapt the NeDB resolver builder.\r\n\r\n* NeDB supports unique indices, but they need to be created in advance. We are not planning to support this with in mem data source. This should be documented.\r\n\r\nTasks:\r\n- [X] allProfiles (query) : simple query\r\n- [X] profile (query) : another simple query, but make sure the return result is proper when no profile found\r\n- [X] createProfile\r\n- [X] updateProfile\r\n- [X] deleteProfile\r\n- [ ] postMeme : Need to use NeDB's `$addToSet` or `$push` to insert stuff into `profile` doc's `memes` property\r\n- [ ] allMemes: Get all `profile.memes` and order them by create/update time\r\n- [ ] deleteMeme: Need to use  NeDb's `$pull`\r\n- [ ] postComment: Insert a comment into `profile.memes[].comments[]`\r\n- [ ] deleteComment\r\n- [ ] What about the timestamps like `meme.createdOn`? Make it working properly with GraphQL and NeDB.\r\n- [ ] Graphql returns an error instead of null when an object not found: https://stackoverflow.com/questions/51287139/graphql-return-a-type-with-non-nullable-id-field-as-a-query-result/51293035#51293035\r\n\r\n**NOTE: We don't have to use the schema in the proposal as-is. For example, that schema doesn't accept a profile id in the `postMeme` mutation because it has the assumption that there's an auth in place. We should just add the profile id param to `postMeme`** "},"comment":{"url":"https://api.github.com/repos/aerogear/data-sync-server/issues/comments/407403425","html_url":"https://github.com/aerogear/data-sync-server/pull/22#issuecomment-407403425","issue_url":"https://api.github.com/repos/aerogear/data-sync-server/issues/22","id":407403425,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzQwMzQyNQ==","user":{"login":"darahayes","id":8656188,"node_id":"MDQ6VXNlcjg2NTYxODg=","avatar_url":"https://avatars1.githubusercontent.com/u/8656188?v=4","gravatar_id":"","url":"https://api.github.com/users/darahayes","html_url":"https://github.com/darahayes","followers_url":"https://api.github.com/users/darahayes/followers","following_url":"https://api.github.com/users/darahayes/following{/other_user}","gists_url":"https://api.github.com/users/darahayes/gists{/gist_id}","starred_url":"https://api.github.com/users/darahayes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darahayes/subscriptions","organizations_url":"https://api.github.com/users/darahayes/orgs","repos_url":"https://api.github.com/users/darahayes/repos","events_url":"https://api.github.com/users/darahayes/events{/privacy}","received_events_url":"https://api.github.com/users/darahayes/received_events","type":"User","site_admin":false},"created_at":"2018-07-24T13:19:28Z","updated_at":"2018-07-24T13:19:28Z","author_association":"CONTRIBUTOR","body":"@wtrocki go for it!"}}
{"actor":{"display_login":"darahayes"}}