{"action":"created","comment":{"url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/comments/121888995","pull_request_review_id":43952088,"id":121888995,"diff_hunk":"@@ -159,28 +160,95 @@ module.exports = (sequelize, DataTypes) => {\n       };\n     });\n \n-    Client.addScope('lease', {\n-      include: [{\n-        model: models.Renting,\n+    Client.addScope('lease', function(date = D.format(Date.now())) {\n+      return {\n         include: [{\n-          model: models.OrderItem,\n-        }, {\n-          model: models.Room,\n+          model: models.Renting,\n+          required: false,\n+          where: {\n+            $or: [{\n+              '$Rentings->Events.id$': null,\n+            }, {\n+              '$Rentings->Events.startDate$': {\n+                $gte: date,\n+              },\n+            }],\n+          },\n           include: [{\n-            model: models.Apartment,\n+            model: models.Event,\n+            required: false,\n             include: [{\n-              model: models.Room,\n+              model: models.Term,\n+              where: {\n+                taxonomy: 'event-category',\n+                name: 'checkout',\n+              },\n+            }],\n+          }, {\n+            model: models.OrderItem,\n+          }, {\n+            model: models.Room,\n+            include: [{\n+              model: models.Apartment,\n+              include: [{\n+                model: models.Room,\n+              }],\n             }],\n           }],\n         }],\n-      }],\n+      };\n     });\n \n     Client.addScope('metadata', {\n       include: [{\n         model: models.Metadata,\n       }],\n     });\n+\n+    Client.addScope('depositOrder', function(date = D.format(Date.now())) {","path":"src/models/client.js","position":66,"original_position":66,"commit_id":"3ad6e589539aff50ef397c96050c8f7b6002aeb0","original_commit_id":"3ad6e589539aff50ef397c96050c8f7b6002aeb0","user":{"login":"louisremi","id":39374,"avatar_url":"https://avatars2.githubusercontent.com/u/39374?v=3","gravatar_id":"","url":"https://api.github.com/users/louisremi","html_url":"https://github.com/louisremi","followers_url":"https://api.github.com/users/louisremi/followers","following_url":"https://api.github.com/users/louisremi/following{/other_user}","gists_url":"https://api.github.com/users/louisremi/gists{/gist_id}","starred_url":"https://api.github.com/users/louisremi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louisremi/subscriptions","organizations_url":"https://api.github.com/users/louisremi/orgs","repos_url":"https://api.github.com/users/louisremi/repos","events_url":"https://api.github.com/users/louisremi/events{/privacy}","received_events_url":"https://api.github.com/users/louisremi/received_events","type":"User","site_admin":false},"body":"same here","created_at":"2017-06-14T08:47:37Z","updated_at":"2017-06-14T08:58:17Z","html_url":"https://github.com/chez-nestor/backoffice/pull/68#discussion_r121888995","pull_request_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/comments/121888995"},"html":{"href":"https://github.com/chez-nestor/backoffice/pull/68#discussion_r121888995"},"pull_request":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68","id":125349027,"html_url":"https://github.com/chez-nestor/backoffice/pull/68","diff_url":"https://github.com/chez-nestor/backoffice/pull/68.diff","patch_url":"https://github.com/chez-nestor/backoffice/pull/68.patch","issue_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/68","number":68,"state":"open","locked":false,"title":"Deposit order","user":{"login":"vquesnel","id":15984663,"avatar_url":"https://avatars1.githubusercontent.com/u/15984663?v=3","gravatar_id":"","url":"https://api.github.com/users/vquesnel","html_url":"https://github.com/vquesnel","followers_url":"https://api.github.com/users/vquesnel/followers","following_url":"https://api.github.com/users/vquesnel/following{/other_user}","gists_url":"https://api.github.com/users/vquesnel/gists{/gist_id}","starred_url":"https://api.github.com/users/vquesnel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vquesnel/subscriptions","organizations_url":"https://api.github.com/users/vquesnel/orgs","repos_url":"https://api.github.com/users/vquesnel/repos","events_url":"https://api.github.com/users/vquesnel/events{/privacy}","received_events_url":"https://api.github.com/users/vquesnel/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-13T12:18:20Z","updated_at":"2017-06-14T08:58:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6624a698b8b6f8abe72967bf8d1cf95596ba7a14","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68/commits","review_comments_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68/comments","review_comment_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/68/comments","statuses_url":"https://api.github.com/repos/chez-nestor/backoffice/statuses/3ad6e589539aff50ef397c96050c8f7b6002aeb0","head":{"label":"chez-nestor:deposit_order","ref":"deposit_order","sha":"3ad6e589539aff50ef397c96050c8f7b6002aeb0","user":{"login":"chez-nestor","id":24920660,"avatar_url":"https://avatars1.githubusercontent.com/u/24920660?v=3","gravatar_id":"","url":"https://api.github.com/users/chez-nestor","html_url":"https://github.com/chez-nestor","followers_url":"https://api.github.com/users/chez-nestor/followers","following_url":"https://api.github.com/users/chez-nestor/following{/other_user}","gists_url":"https://api.github.com/users/chez-nestor/gists{/gist_id}","starred_url":"https://api.github.com/users/chez-nestor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chez-nestor/subscriptions","organizations_url":"https://api.github.com/users/chez-nestor/orgs","repos_url":"https://api.github.com/users/chez-nestor/repos","events_url":"https://api.github.com/users/chez-nestor/events{/privacy}","received_events_url":"https://api.github.com/users/chez-nestor/received_events","type":"Organization","site_admin":false},"repo":{"id":80745212,"name":"backoffice","full_name":"chez-nestor/backoffice","owner":{"login":"chez-nestor","id":24920660,"avatar_url":"https://avatars1.githubusercontent.com/u/24920660?v=3","gravatar_id":"","url":"https://api.github.com/users/chez-nestor","html_url":"https://github.com/chez-nestor","followers_url":"https://api.github.com/users/chez-nestor/followers","following_url":"https://api.github.com/users/chez-nestor/following{/other_user}","gists_url":"https://api.github.com/users/chez-nestor/gists{/gist_id}","starred_url":"https://api.github.com/users/chez-nestor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chez-nestor/subscriptions","organizations_url":"https://api.github.com/users/chez-nestor/orgs","repos_url":"https://api.github.com/users/chez-nestor/repos","events_url":"https://api.github.com/users/chez-nestor/events{/privacy}","received_events_url":"https://api.github.com/users/chez-nestor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chez-nestor/backoffice","description":"Our tailor-made backoffice","fork":false,"url":"https://api.github.com/repos/chez-nestor/backoffice","forks_url":"https://api.github.com/repos/chez-nestor/backoffice/forks","keys_url":"https://api.github.com/repos/chez-nestor/backoffice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chez-nestor/backoffice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chez-nestor/backoffice/teams","hooks_url":"https://api.github.com/repos/chez-nestor/backoffice/hooks","issue_events_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/events{/number}","events_url":"https://api.github.com/repos/chez-nestor/backoffice/events","assignees_url":"https://api.github.com/repos/chez-nestor/backoffice/assignees{/user}","branches_url":"https://api.github.com/repos/chez-nestor/backoffice/branches{/branch}","tags_url":"https://api.github.com/repos/chez-nestor/backoffice/tags","blobs_url":"https://api.github.com/repos/chez-nestor/backoffice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chez-nestor/backoffice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chez-nestor/backoffice/git/refs{/sha}","trees_url":"https://api.github.com/repos/chez-nestor/backoffice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chez-nestor/backoffice/statuses/{sha}","languages_url":"https://api.github.com/repos/chez-nestor/backoffice/languages","stargazers_url":"https://api.github.com/repos/chez-nestor/backoffice/stargazers","contributors_url":"https://api.github.com/repos/chez-nestor/backoffice/contributors","subscribers_url":"https://api.github.com/repos/chez-nestor/backoffice/subscribers","subscription_url":"https://api.github.com/repos/chez-nestor/backoffice/subscription","commits_url":"https://api.github.com/repos/chez-nestor/backoffice/commits{/sha}","git_commits_url":"https://api.github.com/repos/chez-nestor/backoffice/git/commits{/sha}","comments_url":"https://api.github.com/repos/chez-nestor/backoffice/comments{/number}","issue_comment_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/comments{/number}","contents_url":"https://api.github.com/repos/chez-nestor/backoffice/contents/{+path}","compare_url":"https://api.github.com/repos/chez-nestor/backoffice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chez-nestor/backoffice/merges","archive_url":"https://api.github.com/repos/chez-nestor/backoffice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chez-nestor/backoffice/downloads","issues_url":"https://api.github.com/repos/chez-nestor/backoffice/issues{/number}","pulls_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls{/number}","milestones_url":"https://api.github.com/repos/chez-nestor/backoffice/milestones{/number}","notifications_url":"https://api.github.com/repos/chez-nestor/backoffice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chez-nestor/backoffice/labels{/name}","releases_url":"https://api.github.com/repos/chez-nestor/backoffice/releases{/id}","deployments_url":"https://api.github.com/repos/chez-nestor/backoffice/deployments","created_at":"2017-02-02T16:41:37Z","updated_at":"2017-03-30T08:25:52Z","pushed_at":"2017-06-14T08:36:42Z","git_url":"git://github.com/chez-nestor/backoffice.git","ssh_url":"git@github.com:chez-nestor/backoffice.git","clone_url":"https://github.com/chez-nestor/backoffice.git","svn_url":"https://github.com/chez-nestor/backoffice","homepage":"","size":1003,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":0,"default_branch":"master"}},"base":{"label":"chez-nestor:master","ref":"master","sha":"893afbc3a1debfd707906692cac744cd274f8c8d","user":{"login":"chez-nestor","id":24920660,"avatar_url":"https://avatars1.githubusercontent.com/u/24920660?v=3","gravatar_id":"","url":"https://api.github.com/users/chez-nestor","html_url":"https://github.com/chez-nestor","followers_url":"https://api.github.com/users/chez-nestor/followers","following_url":"https://api.github.com/users/chez-nestor/following{/other_user}","gists_url":"https://api.github.com/users/chez-nestor/gists{/gist_id}","starred_url":"https://api.github.com/users/chez-nestor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chez-nestor/subscriptions","organizations_url":"https://api.github.com/users/chez-nestor/orgs","repos_url":"https://api.github.com/users/chez-nestor/repos","events_url":"https://api.github.com/users/chez-nestor/events{/privacy}","received_events_url":"https://api.github.com/users/chez-nestor/received_events","type":"Organization","site_admin":false},"repo":{"id":80745212,"name":"backoffice","full_name":"chez-nestor/backoffice","owner":{"login":"chez-nestor","id":24920660,"avatar_url":"https://avatars1.githubusercontent.com/u/24920660?v=3","gravatar_id":"","url":"https://api.github.com/users/chez-nestor","html_url":"https://github.com/chez-nestor","followers_url":"https://api.github.com/users/chez-nestor/followers","following_url":"https://api.github.com/users/chez-nestor/following{/other_user}","gists_url":"https://api.github.com/users/chez-nestor/gists{/gist_id}","starred_url":"https://api.github.com/users/chez-nestor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chez-nestor/subscriptions","organizations_url":"https://api.github.com/users/chez-nestor/orgs","repos_url":"https://api.github.com/users/chez-nestor/repos","events_url":"https://api.github.com/users/chez-nestor/events{/privacy}","received_events_url":"https://api.github.com/users/chez-nestor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chez-nestor/backoffice","description":"Our tailor-made backoffice","fork":false,"url":"https://api.github.com/repos/chez-nestor/backoffice","forks_url":"https://api.github.com/repos/chez-nestor/backoffice/forks","keys_url":"https://api.github.com/repos/chez-nestor/backoffice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chez-nestor/backoffice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chez-nestor/backoffice/teams","hooks_url":"https://api.github.com/repos/chez-nestor/backoffice/hooks","issue_events_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/events{/number}","events_url":"https://api.github.com/repos/chez-nestor/backoffice/events","assignees_url":"https://api.github.com/repos/chez-nestor/backoffice/assignees{/user}","branches_url":"https://api.github.com/repos/chez-nestor/backoffice/branches{/branch}","tags_url":"https://api.github.com/repos/chez-nestor/backoffice/tags","blobs_url":"https://api.github.com/repos/chez-nestor/backoffice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chez-nestor/backoffice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chez-nestor/backoffice/git/refs{/sha}","trees_url":"https://api.github.com/repos/chez-nestor/backoffice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chez-nestor/backoffice/statuses/{sha}","languages_url":"https://api.github.com/repos/chez-nestor/backoffice/languages","stargazers_url":"https://api.github.com/repos/chez-nestor/backoffice/stargazers","contributors_url":"https://api.github.com/repos/chez-nestor/backoffice/contributors","subscribers_url":"https://api.github.com/repos/chez-nestor/backoffice/subscribers","subscription_url":"https://api.github.com/repos/chez-nestor/backoffice/subscription","commits_url":"https://api.github.com/repos/chez-nestor/backoffice/commits{/sha}","git_commits_url":"https://api.github.com/repos/chez-nestor/backoffice/git/commits{/sha}","comments_url":"https://api.github.com/repos/chez-nestor/backoffice/comments{/number}","issue_comment_url":"https://api.github.com/repos/chez-nestor/backoffice/issues/comments{/number}","contents_url":"https://api.github.com/repos/chez-nestor/backoffice/contents/{+path}","compare_url":"https://api.github.com/repos/chez-nestor/backoffice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chez-nestor/backoffice/merges","archive_url":"https://api.github.com/repos/chez-nestor/backoffice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chez-nestor/backoffice/downloads","issues_url":"https://api.github.com/repos/chez-nestor/backoffice/issues{/number}","pulls_url":"https://api.github.com/repos/chez-nestor/backoffice/pulls{/number}","milestones_url":"https://api.github.com/repos/chez-nestor/backoffice/milestones{/number}","notifications_url":"https://api.github.com/repos/chez-nestor/backoffice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chez-nestor/backoffice/labels{/name}","releases_url":"https://api.github.com/repos/chez-nestor/backoffice/releases{/id}","deployments_url":"https://api.github.com/repos/chez-nestor/backoffice/deployments","created_at":"2017-02-02T16:41:37Z","updated_at":"2017-03-30T08:25:52Z","pushed_at":"2017-06-14T08:36:42Z","git_url":"git://github.com/chez-nestor/backoffice.git","ssh_url":"git@github.com:chez-nestor/backoffice.git","clone_url":"https://github.com/chez-nestor/backoffice.git","svn_url":"https://github.com/chez-nestor/backoffice","homepage":"","size":1003,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68"},"html":{"href":"https://github.com/chez-nestor/backoffice/pull/68"},"issue":{"href":"https://api.github.com/repos/chez-nestor/backoffice/issues/68"},"comments":{"href":"https://api.github.com/repos/chez-nestor/backoffice/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chez-nestor/backoffice/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/chez-nestor/backoffice/statuses/3ad6e589539aff50ef397c96050c8f7b6002aeb0"}}}}
{"actor":{"display_login":"louisremi"}}