{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/6103","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/6103/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/6103/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/6103/events","html_url":"https://github.com/sequelize/sequelize/pull/6103","id":160129159,"number":6103,"title":"model: only rewrite `include.as` if necessary","user":{"login":"LoicMahieu","id":900947,"avatar_url":"https://avatars.githubusercontent.com/u/900947?v=3","gravatar_id":"","url":"https://api.github.com/users/LoicMahieu","html_url":"https://github.com/LoicMahieu","followers_url":"https://api.github.com/users/LoicMahieu/followers","following_url":"https://api.github.com/users/LoicMahieu/following{/other_user}","gists_url":"https://api.github.com/users/LoicMahieu/gists{/gist_id}","starred_url":"https://api.github.com/users/LoicMahieu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LoicMahieu/subscriptions","organizations_url":"https://api.github.com/users/LoicMahieu/orgs","repos_url":"https://api.github.com/users/LoicMahieu/repos","events_url":"https://api.github.com/users/LoicMahieu/events{/privacy}","received_events_url":"https://api.github.com/users/LoicMahieu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-14T08:53:38Z","updated_at":"2016-07-01T15:16:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/6103","html_url":"https://github.com/sequelize/sequelize/pull/6103","diff_url":"https://github.com/sequelize/sequelize/pull/6103.diff","patch_url":"https://github.com/sequelize/sequelize/pull/6103.patch"},"body":"### Pull Request check-list\r\n\r\n- [x] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [ ] Does your issue contain a link to existing issue (Closes #[issue]) or a description of the issue you are solving?\r\n- [x] Have you added new tests to prevent regressions?\r\n- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n\r\nNot necessary I think. Documentation already refers the `options.include[].as` and `options.include[].association`.\r\n\r\n- [ ] Have you added an entry under `Future` in the changelog?\r\n\r\n### Description of change\r\n\r\nIt allows us to `include` the same association multiple times with a different `as`.\r\nExample:\r\n```js\r\nuser.findAll({\r\n  include: [\r\n    { association: User.Tasks, as: 'someTasks', where: { name: { $like: 'bar' } },\r\n    { association: User.Tasks, as: 'otherTasks', where: { name: { $like: 'foo' } }\r\n  ]\r\n})\r\n```\r\n\r\nMy user case: I use [graphql-sequelize](https://github.com/mickhansen/graphql-sequelize) and it generates `include` for nested object/properties. I had to apply a `where` clause on a relationship and I can't modify the options after the nested `include`.\r\n\r\n### Note\r\n\r\nPR also applies for v4 but I am waiting review before submitting another PR.\r\n\r\nThanks for review.\r\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/229973546","html_url":"https://github.com/sequelize/sequelize/pull/6103#issuecomment-229973546","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/6103","id":229973546,"user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars.githubusercontent.com/u/699049?v=3","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":"2016-07-01T15:16:26Z","updated_at":"2016-07-01T15:16:26Z","body":"@janmeier I'm on the fence, i think it's ok for `association` though."}}
{"actor":{"display_login":"mickhansen"}}