{"action":"created","comment":{"url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/comments/136535312","pull_request_review_id":60087789,"id":136535312,"diff_hunk":"@@ -0,0 +1,50 @@\n+const { pick, pickBy } = require('lodash')\n+\n+const { search } = require('../search/services')\n+const { transformApiResponseToSearchCollection } = require('../search/transformers')\n+const { transformCompanyToListItem } = require('./transformers')\n+\n+async function getCompanyCollection (req, res, next) {\n+  const searchEntity = 'company'\n+\n+  try {\n+    res.locals.results = await search({\n+      searchTerm: '',","path":"src/apps/companies/middleware.js","position":12,"original_position":12,"commit_id":"b7ae601e9264f4243c70e07d63da0eb620db2631","original_commit_id":"b7ae601e9264f4243c70e07d63da0eb620db2631","user":{"login":"teneightfive","id":3327997,"avatar_url":"https://avatars1.githubusercontent.com/u/3327997?v=4","gravatar_id":"","url":"https://api.github.com/users/teneightfive","html_url":"https://github.com/teneightfive","followers_url":"https://api.github.com/users/teneightfive/followers","following_url":"https://api.github.com/users/teneightfive/following{/other_user}","gists_url":"https://api.github.com/users/teneightfive/gists{/gist_id}","starred_url":"https://api.github.com/users/teneightfive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teneightfive/subscriptions","organizations_url":"https://api.github.com/users/teneightfive/orgs","repos_url":"https://api.github.com/users/teneightfive/repos","events_url":"https://api.github.com/users/teneightfive/events{/privacy}","received_events_url":"https://api.github.com/users/teneightfive/received_events","type":"User","site_admin":false},"body":"This can be removed.","created_at":"2017-09-01T09:34:06Z","updated_at":"2017-09-01T09:34:06Z","html_url":"https://github.com/uktrade/data-hub-frontend/pull/521#discussion_r136535312","pull_request_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/comments/136535312"},"html":{"href":"https://github.com/uktrade/data-hub-frontend/pull/521#discussion_r136535312"},"pull_request":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521"}}},"pull_request":{"url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521","id":138701352,"html_url":"https://github.com/uktrade/data-hub-frontend/pull/521","diff_url":"https://github.com/uktrade/data-hub-frontend/pull/521.diff","patch_url":"https://github.com/uktrade/data-hub-frontend/pull/521.patch","issue_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/521","number":521,"state":"open","locked":false,"title":"Companies collections","user":{"login":"tyom","id":203886,"avatar_url":"https://avatars3.githubusercontent.com/u/203886?v=4","gravatar_id":"","url":"https://api.github.com/users/tyom","html_url":"https://github.com/tyom","followers_url":"https://api.github.com/users/tyom/followers","following_url":"https://api.github.com/users/tyom/following{/other_user}","gists_url":"https://api.github.com/users/tyom/gists{/gist_id}","starred_url":"https://api.github.com/users/tyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyom/subscriptions","organizations_url":"https://api.github.com/users/tyom/orgs","repos_url":"https://api.github.com/users/tyom/repos","events_url":"https://api.github.com/users/tyom/events{/privacy}","received_events_url":"https://api.github.com/users/tyom/received_events","type":"User","site_admin":false},"body":"- Create new endpoint for /companies with collection and a set of filters and sorting options\r\n\r\nTODO\r\n- [x] Add collections for company search\r\n- [x] Add unit tests\r\n\r\n### 💥 [Demo](https://datahub-beta2-pr-521.herokuapp.com/companies) 💥\r\n\r\n### What it looks like\r\n\r\n#### Search\r\n\r\n![localhost_3000_search_companies_term lol](https://user-images.githubusercontent.com/203886/29938444-a1022d6e-8e80-11e7-86bf-568d52a40a79.png)\r\n\r\n#### /companies\r\n\r\n![localhost_3000_companies_sortby modified_on 3aasc](https://user-images.githubusercontent.com/203886/29938582-2dfd3ee8-8e81-11e7-9186-ca7d3eae04bd.png)\r\n","created_at":"2017-08-31T15:44:05Z","updated_at":"2017-09-01T09:34:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7272af7117ca50d3875acfbeabbd4929ac298758","assignee":{"login":"tyom","id":203886,"avatar_url":"https://avatars3.githubusercontent.com/u/203886?v=4","gravatar_id":"","url":"https://api.github.com/users/tyom","html_url":"https://github.com/tyom","followers_url":"https://api.github.com/users/tyom/followers","following_url":"https://api.github.com/users/tyom/following{/other_user}","gists_url":"https://api.github.com/users/tyom/gists{/gist_id}","starred_url":"https://api.github.com/users/tyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyom/subscriptions","organizations_url":"https://api.github.com/users/tyom/orgs","repos_url":"https://api.github.com/users/tyom/repos","events_url":"https://api.github.com/users/tyom/events{/privacy}","received_events_url":"https://api.github.com/users/tyom/received_events","type":"User","site_admin":false},"assignees":[{"login":"tyom","id":203886,"avatar_url":"https://avatars3.githubusercontent.com/u/203886?v=4","gravatar_id":"","url":"https://api.github.com/users/tyom","html_url":"https://github.com/tyom","followers_url":"https://api.github.com/users/tyom/followers","following_url":"https://api.github.com/users/tyom/following{/other_user}","gists_url":"https://api.github.com/users/tyom/gists{/gist_id}","starred_url":"https://api.github.com/users/tyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tyom/subscriptions","organizations_url":"https://api.github.com/users/tyom/orgs","repos_url":"https://api.github.com/users/tyom/repos","events_url":"https://api.github.com/users/tyom/events{/privacy}","received_events_url":"https://api.github.com/users/tyom/received_events","type":"User","site_admin":false},{"login":"feedmypixel","id":2305016,"avatar_url":"https://avatars0.githubusercontent.com/u/2305016?v=4","gravatar_id":"","url":"https://api.github.com/users/feedmypixel","html_url":"https://github.com/feedmypixel","followers_url":"https://api.github.com/users/feedmypixel/followers","following_url":"https://api.github.com/users/feedmypixel/following{/other_user}","gists_url":"https://api.github.com/users/feedmypixel/gists{/gist_id}","starred_url":"https://api.github.com/users/feedmypixel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feedmypixel/subscriptions","organizations_url":"https://api.github.com/users/feedmypixel/orgs","repos_url":"https://api.github.com/users/feedmypixel/repos","events_url":"https://api.github.com/users/feedmypixel/events{/privacy}","received_events_url":"https://api.github.com/users/feedmypixel/received_events","type":"User","site_admin":false},{"login":"teneightfive","id":3327997,"avatar_url":"https://avatars1.githubusercontent.com/u/3327997?v=4","gravatar_id":"","url":"https://api.github.com/users/teneightfive","html_url":"https://github.com/teneightfive","followers_url":"https://api.github.com/users/teneightfive/followers","following_url":"https://api.github.com/users/teneightfive/following{/other_user}","gists_url":"https://api.github.com/users/teneightfive/gists{/gist_id}","starred_url":"https://api.github.com/users/teneightfive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teneightfive/subscriptions","organizations_url":"https://api.github.com/users/teneightfive/orgs","repos_url":"https://api.github.com/users/teneightfive/repos","events_url":"https://api.github.com/users/teneightfive/events{/privacy}","received_events_url":"https://api.github.com/users/teneightfive/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"ztolley","id":56056,"avatar_url":"https://avatars1.githubusercontent.com/u/56056?v=4","gravatar_id":"","url":"https://api.github.com/users/ztolley","html_url":"https://github.com/ztolley","followers_url":"https://api.github.com/users/ztolley/followers","following_url":"https://api.github.com/users/ztolley/following{/other_user}","gists_url":"https://api.github.com/users/ztolley/gists{/gist_id}","starred_url":"https://api.github.com/users/ztolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ztolley/subscriptions","organizations_url":"https://api.github.com/users/ztolley/orgs","repos_url":"https://api.github.com/users/ztolley/repos","events_url":"https://api.github.com/users/ztolley/events{/privacy}","received_events_url":"https://api.github.com/users/ztolley/received_events","type":"User","site_admin":false},{"login":"yeahfro","id":1150417,"avatar_url":"https://avatars0.githubusercontent.com/u/1150417?v=4","gravatar_id":"","url":"https://api.github.com/users/yeahfro","html_url":"https://github.com/yeahfro","followers_url":"https://api.github.com/users/yeahfro/followers","following_url":"https://api.github.com/users/yeahfro/following{/other_user}","gists_url":"https://api.github.com/users/yeahfro/gists{/gist_id}","starred_url":"https://api.github.com/users/yeahfro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeahfro/subscriptions","organizations_url":"https://api.github.com/users/yeahfro/orgs","repos_url":"https://api.github.com/users/yeahfro/repos","events_url":"https://api.github.com/users/yeahfro/events{/privacy}","received_events_url":"https://api.github.com/users/yeahfro/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521/commits","review_comments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521/comments","review_comment_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/521/comments","statuses_url":"https://api.github.com/repos/uktrade/data-hub-frontend/statuses/b7ae601e9264f4243c70e07d63da0eb620db2631","head":{"label":"uktrade:collection-company","ref":"collection-company","sha":"b7ae601e9264f4243c70e07d63da0eb620db2631","user":{"login":"uktrade","id":15107524,"avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"repo":{"id":83823675,"name":"data-hub-frontend","full_name":"uktrade/data-hub-frontend","owner":{"login":"uktrade","id":15107524,"avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uktrade/data-hub-frontend","description":"The frontend rendering application for Data Hub","fork":false,"url":"https://api.github.com/repos/uktrade/data-hub-frontend","forks_url":"https://api.github.com/repos/uktrade/data-hub-frontend/forks","keys_url":"https://api.github.com/repos/uktrade/data-hub-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uktrade/data-hub-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uktrade/data-hub-frontend/teams","hooks_url":"https://api.github.com/repos/uktrade/data-hub-frontend/hooks","issue_events_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/uktrade/data-hub-frontend/events","assignees_url":"https://api.github.com/repos/uktrade/data-hub-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/uktrade/data-hub-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/uktrade/data-hub-frontend/tags","blobs_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uktrade/data-hub-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/uktrade/data-hub-frontend/languages","stargazers_url":"https://api.github.com/repos/uktrade/data-hub-frontend/stargazers","contributors_url":"https://api.github.com/repos/uktrade/data-hub-frontend/contributors","subscribers_url":"https://api.github.com/repos/uktrade/data-hub-frontend/subscribers","subscription_url":"https://api.github.com/repos/uktrade/data-hub-frontend/subscription","commits_url":"https://api.github.com/repos/uktrade/data-hub-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/uktrade/data-hub-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/uktrade/data-hub-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uktrade/data-hub-frontend/merges","archive_url":"https://api.github.com/repos/uktrade/data-hub-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uktrade/data-hub-frontend/downloads","issues_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/uktrade/data-hub-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/uktrade/data-hub-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uktrade/data-hub-frontend/labels{/name}","releases_url":"https://api.github.com/repos/uktrade/data-hub-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/deployments","created_at":"2017-03-03T17:26:35Z","updated_at":"2017-08-16T08:31:47Z","pushed_at":"2017-08-31T18:12:10Z","git_url":"git://github.com/uktrade/data-hub-frontend.git","ssh_url":"git@github.com:uktrade/data-hub-frontend.git","clone_url":"https://github.com/uktrade/data-hub-frontend.git","svn_url":"https://github.com/uktrade/data-hub-frontend","homepage":"","size":2362,"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":26,"forks":0,"open_issues":26,"watchers":0,"default_branch":"develop"}},"base":{"label":"uktrade:develop","ref":"develop","sha":"ccdde40f1db4fee97ac3686464d5aa096908f331","user":{"login":"uktrade","id":15107524,"avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"repo":{"id":83823675,"name":"data-hub-frontend","full_name":"uktrade/data-hub-frontend","owner":{"login":"uktrade","id":15107524,"avatar_url":"https://avatars2.githubusercontent.com/u/15107524?v=4","gravatar_id":"","url":"https://api.github.com/users/uktrade","html_url":"https://github.com/uktrade","followers_url":"https://api.github.com/users/uktrade/followers","following_url":"https://api.github.com/users/uktrade/following{/other_user}","gists_url":"https://api.github.com/users/uktrade/gists{/gist_id}","starred_url":"https://api.github.com/users/uktrade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uktrade/subscriptions","organizations_url":"https://api.github.com/users/uktrade/orgs","repos_url":"https://api.github.com/users/uktrade/repos","events_url":"https://api.github.com/users/uktrade/events{/privacy}","received_events_url":"https://api.github.com/users/uktrade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uktrade/data-hub-frontend","description":"The frontend rendering application for Data Hub","fork":false,"url":"https://api.github.com/repos/uktrade/data-hub-frontend","forks_url":"https://api.github.com/repos/uktrade/data-hub-frontend/forks","keys_url":"https://api.github.com/repos/uktrade/data-hub-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uktrade/data-hub-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uktrade/data-hub-frontend/teams","hooks_url":"https://api.github.com/repos/uktrade/data-hub-frontend/hooks","issue_events_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/uktrade/data-hub-frontend/events","assignees_url":"https://api.github.com/repos/uktrade/data-hub-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/uktrade/data-hub-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/uktrade/data-hub-frontend/tags","blobs_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uktrade/data-hub-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/uktrade/data-hub-frontend/languages","stargazers_url":"https://api.github.com/repos/uktrade/data-hub-frontend/stargazers","contributors_url":"https://api.github.com/repos/uktrade/data-hub-frontend/contributors","subscribers_url":"https://api.github.com/repos/uktrade/data-hub-frontend/subscribers","subscription_url":"https://api.github.com/repos/uktrade/data-hub-frontend/subscription","commits_url":"https://api.github.com/repos/uktrade/data-hub-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/uktrade/data-hub-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/uktrade/data-hub-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/uktrade/data-hub-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uktrade/data-hub-frontend/merges","archive_url":"https://api.github.com/repos/uktrade/data-hub-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uktrade/data-hub-frontend/downloads","issues_url":"https://api.github.com/repos/uktrade/data-hub-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/uktrade/data-hub-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/uktrade/data-hub-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uktrade/data-hub-frontend/labels{/name}","releases_url":"https://api.github.com/repos/uktrade/data-hub-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/uktrade/data-hub-frontend/deployments","created_at":"2017-03-03T17:26:35Z","updated_at":"2017-08-16T08:31:47Z","pushed_at":"2017-08-31T18:12:10Z","git_url":"git://github.com/uktrade/data-hub-frontend.git","ssh_url":"git@github.com:uktrade/data-hub-frontend.git","clone_url":"https://github.com/uktrade/data-hub-frontend.git","svn_url":"https://github.com/uktrade/data-hub-frontend","homepage":"","size":2362,"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":26,"forks":0,"open_issues":26,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521"},"html":{"href":"https://github.com/uktrade/data-hub-frontend/pull/521"},"issue":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/521"},"comments":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/issues/521/comments"},"review_comments":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521/comments"},"review_comment":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/pulls/521/commits"},"statuses":{"href":"https://api.github.com/repos/uktrade/data-hub-frontend/statuses/b7ae601e9264f4243c70e07d63da0eb620db2631"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"teneightfive"}}