{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments/78158153","id":78158153,"diff_hunk":"@@ -0,0 +1,124 @@\n+/*\n+ * Copyright 2016 HM Revenue & Customs\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package services.search\n+\n+import connectors.AuthProviderClient\n+import model.Commands.{ Candidate, SearchCandidate }\n+import model.Exceptions.{ ApplicationNotFound, ContactDetailsNotFound, PersonalDetailsNotFound }\n+import model.PersistedObjects.ContactDetailsWithId\n+import org.joda.time.LocalDate\n+import repositories._\n+import repositories.application.{ GeneralApplicationRepository, PersonalDetailsRepository }\n+import uk.gov.hmrc.play.http.HeaderCarrier\n+\n+import scala.concurrent.Future\n+import scala.concurrent.ExecutionContext.Implicits.global\n+\n+object SearchForApplicantService extends SearchForApplicantService {\n+  val appRepository = applicationRepository\n+  val psRepository = personalDetailsRepository\n+  val cdRepository = contactDetailsRepository\n+  val authProviderClient = AuthProviderClient\n+}\n+\n+trait SearchForApplicantService {\n+\n+  val appRepository: GeneralApplicationRepository\n+  val psRepository: PersonalDetailsRepository\n+  val cdRepository: ContactDetailsRepository\n+  val authProviderClient: AuthProviderClient\n+\n+  def findByCriteria(searchCandidate: SearchCandidate)(implicit hc: HeaderCarrier): Future[List[Candidate]] = searchCandidate match {\n+    case SearchCandidate(None, None, None, Some(postCode)) => searchByPostCode(postCode)\n+\n+    case SearchCandidate(firstOrPreferredName, lastName, dateOfBirth, postCode) =>\n+      searchByAllNamesOrDobAndFilterPostCode(firstOrPreferredName, lastName, dateOfBirth, postCode)\n+\n+    case _ => Future.successful(Nil)","path":"app/services/search/SearchForApplicantService.scala","position":null,"original_position":51,"commit_id":"f77058e2c0dbad843d1b15b3e29928b76992b2a4","original_commit_id":"0105751ac74a9c8959e6dedefa399247089b3a83","user":{"login":"henricook","id":82004,"avatar_url":"https://avatars.githubusercontent.com/u/82004?v=3","gravatar_id":"","url":"https://api.github.com/users/henricook","html_url":"https://github.com/henricook","followers_url":"https://api.github.com/users/henricook/followers","following_url":"https://api.github.com/users/henricook/following{/other_user}","gists_url":"https://api.github.com/users/henricook/gists{/gist_id}","starred_url":"https://api.github.com/users/henricook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henricook/subscriptions","organizations_url":"https://api.github.com/users/henricook/orgs","repos_url":"https://api.github.com/users/henricook/repos","events_url":"https://api.github.com/users/henricook/events{/privacy}","received_events_url":"https://api.github.com/users/henricook/received_events","type":"User","site_admin":false},"body":"I think it is unreachable, i've removed the default case and pushed","created_at":"2016-09-09T10:18:15Z","updated_at":"2016-09-09T10:18:15Z","html_url":"https://github.com/hmrc/fset-faststream/pull/25#discussion_r78158153","pull_request_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments/78158153"},"html":{"href":"https://github.com/hmrc/fset-faststream/pull/25#discussion_r78158153"},"pull_request":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25","id":84295932,"html_url":"https://github.com/hmrc/fset-faststream/pull/25","diff_url":"https://github.com/hmrc/fset-faststream/pull/25.diff","patch_url":"https://github.com/hmrc/fset-faststream/pull/25.patch","issue_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/25","number":25,"state":"open","locked":false,"title":"FSET-706: Implement candidate search in the admin-frontend","user":{"login":"henricook","id":82004,"avatar_url":"https://avatars.githubusercontent.com/u/82004?v=3","gravatar_id":"","url":"https://api.github.com/users/henricook","html_url":"https://github.com/henricook","followers_url":"https://api.github.com/users/henricook/followers","following_url":"https://api.github.com/users/henricook/following{/other_user}","gists_url":"https://api.github.com/users/henricook/gists{/gist_id}","starred_url":"https://api.github.com/users/henricook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henricook/subscriptions","organizations_url":"https://api.github.com/users/henricook/orgs","repos_url":"https://api.github.com/users/henricook/repos","events_url":"https://api.github.com/users/henricook/events{/privacy}","received_events_url":"https://api.github.com/users/henricook/received_events","type":"User","site_admin":false},"body":" - Add first or preferred name search.\r\n - Return users that are still in REGISTERED from the auth provider.\r\n - Update test data genny to take post code, dob and email address details\r\n\r\nRefactoring:\r\n - Move logic out of SearchForApplicantController to a service (SearchForApplicantService).\r\n - When searching by user details and a post code, we now search by post code first so that we then have a list of userIds to query for (rather then previous where we were potentially querying the entire collecton) and can then enrich the result with contact details.\r\n","created_at":"2016-09-07T13:03:06Z","updated_at":"2016-09-09T10:18:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdaefb57db6423339182732aa6adb19989e6abc5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25/commits","review_comments_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25/comments","review_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/25/comments","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/f77058e2c0dbad843d1b15b3e29928b76992b2a4","head":{"label":"hmrc:fset-706","ref":"fset-706","sha":"f77058e2c0dbad843d1b15b3e29928b76992b2a4","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":62889113,"name":"fset-faststream","full_name":"hmrc/fset-faststream","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/fset-faststream","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/fset-faststream","forks_url":"https://api.github.com/repos/hmrc/fset-faststream/forks","keys_url":"https://api.github.com/repos/hmrc/fset-faststream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/fset-faststream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/fset-faststream/teams","hooks_url":"https://api.github.com/repos/hmrc/fset-faststream/hooks","issue_events_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/fset-faststream/events","assignees_url":"https://api.github.com/repos/hmrc/fset-faststream/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/fset-faststream/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/fset-faststream/tags","blobs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/fset-faststream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/fset-faststream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/fset-faststream/languages","stargazers_url":"https://api.github.com/repos/hmrc/fset-faststream/stargazers","contributors_url":"https://api.github.com/repos/hmrc/fset-faststream/contributors","subscribers_url":"https://api.github.com/repos/hmrc/fset-faststream/subscribers","subscription_url":"https://api.github.com/repos/hmrc/fset-faststream/subscription","commits_url":"https://api.github.com/repos/hmrc/fset-faststream/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/fset-faststream/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/fset-faststream/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/fset-faststream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/fset-faststream/merges","archive_url":"https://api.github.com/repos/hmrc/fset-faststream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/fset-faststream/downloads","issues_url":"https://api.github.com/repos/hmrc/fset-faststream/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/fset-faststream/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/fset-faststream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/fset-faststream/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/fset-faststream/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/fset-faststream/deployments","created_at":"2016-07-08T13:03:46Z","updated_at":"2016-07-13T15:13:30Z","pushed_at":"2016-09-09T10:18:09Z","git_url":"git://github.com/hmrc/fset-faststream.git","ssh_url":"git@github.com:hmrc/fset-faststream.git","clone_url":"https://github.com/hmrc/fset-faststream.git","svn_url":"https://github.com/hmrc/fset-faststream","homepage":"","size":551,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"hmrc:master","ref":"master","sha":"f3438e32f4939639d585055835b603faffa03ad5","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":62889113,"name":"fset-faststream","full_name":"hmrc/fset-faststream","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/fset-faststream","description":null,"fork":false,"url":"https://api.github.com/repos/hmrc/fset-faststream","forks_url":"https://api.github.com/repos/hmrc/fset-faststream/forks","keys_url":"https://api.github.com/repos/hmrc/fset-faststream/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/fset-faststream/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/fset-faststream/teams","hooks_url":"https://api.github.com/repos/hmrc/fset-faststream/hooks","issue_events_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/fset-faststream/events","assignees_url":"https://api.github.com/repos/hmrc/fset-faststream/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/fset-faststream/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/fset-faststream/tags","blobs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/fset-faststream/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/fset-faststream/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/fset-faststream/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/fset-faststream/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/fset-faststream/languages","stargazers_url":"https://api.github.com/repos/hmrc/fset-faststream/stargazers","contributors_url":"https://api.github.com/repos/hmrc/fset-faststream/contributors","subscribers_url":"https://api.github.com/repos/hmrc/fset-faststream/subscribers","subscription_url":"https://api.github.com/repos/hmrc/fset-faststream/subscription","commits_url":"https://api.github.com/repos/hmrc/fset-faststream/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/fset-faststream/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/fset-faststream/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/fset-faststream/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/fset-faststream/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/fset-faststream/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/fset-faststream/merges","archive_url":"https://api.github.com/repos/hmrc/fset-faststream/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/fset-faststream/downloads","issues_url":"https://api.github.com/repos/hmrc/fset-faststream/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/fset-faststream/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/fset-faststream/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/fset-faststream/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/fset-faststream/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/fset-faststream/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/fset-faststream/deployments","created_at":"2016-07-08T13:03:46Z","updated_at":"2016-07-13T15:13:30Z","pushed_at":"2016-09-09T10:18:09Z","git_url":"git://github.com/hmrc/fset-faststream.git","ssh_url":"git@github.com:hmrc/fset-faststream.git","clone_url":"https://github.com/hmrc/fset-faststream.git","svn_url":"https://github.com/hmrc/fset-faststream","homepage":"","size":551,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25"},"html":{"href":"https://github.com/hmrc/fset-faststream/pull/25"},"issue":{"href":"https://api.github.com/repos/hmrc/fset-faststream/issues/25"},"comments":{"href":"https://api.github.com/repos/hmrc/fset-faststream/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/fset-faststream/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/fset-faststream/statuses/f77058e2c0dbad843d1b15b3e29928b76992b2a4"}}}}
{"actor":{"display_login":"henricook"}}