{"action":"created","comment":{"url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/comments/236648098","pull_request_review_id":178754205,"id":236648098,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjY0ODA5OA==","diff_hunk":"@@ -0,0 +1,30 @@\n+package uk.gov.cslearning.record.validation.validators;\n+\n+import org.springframework.stereotype.Component;\n+import uk.gov.cslearning.record.dto.InviteDto;\n+import uk.gov.cslearning.record.service.BookingService;\n+import uk.gov.cslearning.record.validation.annotations.LearnerNotInvited;\n+\n+import javax.validation.ConstraintValidator;\n+import javax.validation.ConstraintValidatorContext;\n+import java.nio.file.Paths;\n+\n+@Component\n+public class LearnerNotBookedValidator implements ConstraintValidator<LearnerNotInvited, InviteDto> {\n+\n+    private final BookingService bookingService;\n+\n+    public LearnerNotBookedValidator(BookingService bookingService) {\n+        this.bookingService = bookingService;\n+    }\n+\n+    public void initialise(LearnerNotInvited constraint) {}\n+\n+    public boolean isValid(InviteDto invite, ConstraintValidatorContext context) {\n+        String eventUid = Paths.get(invite.getEvent().getPath()).getFileName().toString();\n+\n+        return bookingService.isLearnerBookedOnEvent(invite.getLearnerEmail(), eventUid)","path":"src/main/java/uk/gov/cslearning/record/validation/validators/LearnerNotBookedValidator.java","position":26,"original_position":26,"commit_id":"46643af1327b1aa37bd3fdef03253e4f8fb92134","original_commit_id":"46643af1327b1aa37bd3fdef03253e4f8fb92134","user":{"login":"robleney-kainos","id":40387271,"node_id":"MDQ6VXNlcjQwMzg3Mjcx","avatar_url":"https://avatars0.githubusercontent.com/u/40387271?v=4","gravatar_id":"","url":"https://api.github.com/users/robleney-kainos","html_url":"https://github.com/robleney-kainos","followers_url":"https://api.github.com/users/robleney-kainos/followers","following_url":"https://api.github.com/users/robleney-kainos/following{/other_user}","gists_url":"https://api.github.com/users/robleney-kainos/gists{/gist_id}","starred_url":"https://api.github.com/users/robleney-kainos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robleney-kainos/subscriptions","organizations_url":"https://api.github.com/users/robleney-kainos/orgs","repos_url":"https://api.github.com/users/robleney-kainos/repos","events_url":"https://api.github.com/users/robleney-kainos/events{/privacy}","received_events_url":"https://api.github.com/users/robleney-kainos/received_events","type":"User","site_admin":false},"body":"This might be clearer as...\r\n```\r\n    public boolean isValid(InviteDto invite, ConstraintValidatorContext context) {\r\n        String eventUid = Paths.get(invite.getEvent().getPath()).getFileName().toString();\r\n\r\n        return !bookingService.isLearnerBookedOnEvent(invite.getLearnerEmail(), eventUid).isPresent();\r\n    }\r\n```","created_at":"2018-11-27T12:49:30Z","updated_at":"2018-11-27T12:53:40Z","html_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56#discussion_r236648098","pull_request_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/comments/236648098"},"html":{"href":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56#discussion_r236648098"},"pull_request":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56","id":231548423,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNTQ4NDIz","html_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56","diff_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56.diff","patch_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56.patch","issue_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/56","number":56,"state":"open","locked":false,"title":"Lpfg 945 invitee endpoint v2","user":{"login":"Peter-D-Taylor","id":41421291,"node_id":"MDQ6VXNlcjQxNDIxMjkx","avatar_url":"https://avatars0.githubusercontent.com/u/41421291?v=4","gravatar_id":"","url":"https://api.github.com/users/Peter-D-Taylor","html_url":"https://github.com/Peter-D-Taylor","followers_url":"https://api.github.com/users/Peter-D-Taylor/followers","following_url":"https://api.github.com/users/Peter-D-Taylor/following{/other_user}","gists_url":"https://api.github.com/users/Peter-D-Taylor/gists{/gist_id}","starred_url":"https://api.github.com/users/Peter-D-Taylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Peter-D-Taylor/subscriptions","organizations_url":"https://api.github.com/users/Peter-D-Taylor/orgs","repos_url":"https://api.github.com/users/Peter-D-Taylor/repos","events_url":"https://api.github.com/users/Peter-D-Taylor/events{/privacy}","received_events_url":"https://api.github.com/users/Peter-D-Taylor/received_events","type":"User","site_admin":false},"body":"This contains changes to allow the service to check if an email address is registered when inviting a learner, instead of doing this in management.\r\n\r\n- Added check that invitee is unique and a getInvitee function to InviteController.java\r\n- Added findByEventIdLearnerEmail function to InviteRepository.java\r\n- Added identityService and findInvite function to DefaultInviteService.java\r\n- Added getIdentityByEmailAddress function to IdentityService.java\r\n","created_at":"2018-11-16T14:31:48Z","updated_at":"2018-11-27T12:53:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44a4b349a583f7153015375de6a084fe2827949e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56/commits","review_comments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56/comments","review_comment_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/56/comments","statuses_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/statuses/46643af1327b1aa37bd3fdef03253e4f8fb92134","head":{"label":"Civil-Service-Human-Resources:LPFG-945-Invitee-Endpoint-v2","ref":"LPFG-945-Invitee-Endpoint-v2","sha":"46643af1327b1aa37bd3fdef03253e4f8fb92134","user":{"login":"Civil-Service-Human-Resources","id":34069677,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MDY5Njc3","avatar_url":"https://avatars1.githubusercontent.com/u/34069677?v=4","gravatar_id":"","url":"https://api.github.com/users/Civil-Service-Human-Resources","html_url":"https://github.com/Civil-Service-Human-Resources","followers_url":"https://api.github.com/users/Civil-Service-Human-Resources/followers","following_url":"https://api.github.com/users/Civil-Service-Human-Resources/following{/other_user}","gists_url":"https://api.github.com/users/Civil-Service-Human-Resources/gists{/gist_id}","starred_url":"https://api.github.com/users/Civil-Service-Human-Resources/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Civil-Service-Human-Resources/subscriptions","organizations_url":"https://api.github.com/users/Civil-Service-Human-Resources/orgs","repos_url":"https://api.github.com/users/Civil-Service-Human-Resources/repos","events_url":"https://api.github.com/users/Civil-Service-Human-Resources/events{/privacy}","received_events_url":"https://api.github.com/users/Civil-Service-Human-Resources/received_events","type":"Organization","site_admin":false},"repo":{"id":122048499,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIwNDg0OTk=","name":"lpg-learner-record","full_name":"Civil-Service-Human-Resources/lpg-learner-record","private":false,"owner":{"login":"Civil-Service-Human-Resources","id":34069677,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MDY5Njc3","avatar_url":"https://avatars1.githubusercontent.com/u/34069677?v=4","gravatar_id":"","url":"https://api.github.com/users/Civil-Service-Human-Resources","html_url":"https://github.com/Civil-Service-Human-Resources","followers_url":"https://api.github.com/users/Civil-Service-Human-Resources/followers","following_url":"https://api.github.com/users/Civil-Service-Human-Resources/following{/other_user}","gists_url":"https://api.github.com/users/Civil-Service-Human-Resources/gists{/gist_id}","starred_url":"https://api.github.com/users/Civil-Service-Human-Resources/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Civil-Service-Human-Resources/subscriptions","organizations_url":"https://api.github.com/users/Civil-Service-Human-Resources/orgs","repos_url":"https://api.github.com/users/Civil-Service-Human-Resources/repos","events_url":"https://api.github.com/users/Civil-Service-Human-Resources/events{/privacy}","received_events_url":"https://api.github.com/users/Civil-Service-Human-Resources/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record","description":null,"fork":false,"url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record","forks_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/forks","keys_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/teams","hooks_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/hooks","issue_events_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/events{/number}","events_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/events","assignees_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/assignees{/user}","branches_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/branches{/branch}","tags_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/tags","blobs_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/refs{/sha}","trees_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/statuses/{sha}","languages_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/languages","stargazers_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/stargazers","contributors_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/contributors","subscribers_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/subscribers","subscription_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/subscription","commits_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/commits{/sha}","git_commits_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/commits{/sha}","comments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/comments{/number}","issue_comment_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/comments{/number}","contents_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/contents/{+path}","compare_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/merges","archive_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/downloads","issues_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues{/number}","pulls_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls{/number}","milestones_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/milestones{/number}","notifications_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/labels{/name}","releases_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/releases{/id}","deployments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/deployments","created_at":"2018-02-19T10:41:25Z","updated_at":"2018-11-15T17:31:39Z","pushed_at":"2018-11-26T12:26:14Z","git_url":"git://github.com/Civil-Service-Human-Resources/lpg-learner-record.git","ssh_url":"git@github.com:Civil-Service-Human-Resources/lpg-learner-record.git","clone_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record.git","svn_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record","homepage":null,"size":570,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"Civil-Service-Human-Resources:master","ref":"master","sha":"1855e6a9db510035952736fad0e6c23a73f1f6b1","user":{"login":"Civil-Service-Human-Resources","id":34069677,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MDY5Njc3","avatar_url":"https://avatars1.githubusercontent.com/u/34069677?v=4","gravatar_id":"","url":"https://api.github.com/users/Civil-Service-Human-Resources","html_url":"https://github.com/Civil-Service-Human-Resources","followers_url":"https://api.github.com/users/Civil-Service-Human-Resources/followers","following_url":"https://api.github.com/users/Civil-Service-Human-Resources/following{/other_user}","gists_url":"https://api.github.com/users/Civil-Service-Human-Resources/gists{/gist_id}","starred_url":"https://api.github.com/users/Civil-Service-Human-Resources/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Civil-Service-Human-Resources/subscriptions","organizations_url":"https://api.github.com/users/Civil-Service-Human-Resources/orgs","repos_url":"https://api.github.com/users/Civil-Service-Human-Resources/repos","events_url":"https://api.github.com/users/Civil-Service-Human-Resources/events{/privacy}","received_events_url":"https://api.github.com/users/Civil-Service-Human-Resources/received_events","type":"Organization","site_admin":false},"repo":{"id":122048499,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIwNDg0OTk=","name":"lpg-learner-record","full_name":"Civil-Service-Human-Resources/lpg-learner-record","private":false,"owner":{"login":"Civil-Service-Human-Resources","id":34069677,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MDY5Njc3","avatar_url":"https://avatars1.githubusercontent.com/u/34069677?v=4","gravatar_id":"","url":"https://api.github.com/users/Civil-Service-Human-Resources","html_url":"https://github.com/Civil-Service-Human-Resources","followers_url":"https://api.github.com/users/Civil-Service-Human-Resources/followers","following_url":"https://api.github.com/users/Civil-Service-Human-Resources/following{/other_user}","gists_url":"https://api.github.com/users/Civil-Service-Human-Resources/gists{/gist_id}","starred_url":"https://api.github.com/users/Civil-Service-Human-Resources/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Civil-Service-Human-Resources/subscriptions","organizations_url":"https://api.github.com/users/Civil-Service-Human-Resources/orgs","repos_url":"https://api.github.com/users/Civil-Service-Human-Resources/repos","events_url":"https://api.github.com/users/Civil-Service-Human-Resources/events{/privacy}","received_events_url":"https://api.github.com/users/Civil-Service-Human-Resources/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record","description":null,"fork":false,"url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record","forks_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/forks","keys_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/teams","hooks_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/hooks","issue_events_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/events{/number}","events_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/events","assignees_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/assignees{/user}","branches_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/branches{/branch}","tags_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/tags","blobs_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/refs{/sha}","trees_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/statuses/{sha}","languages_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/languages","stargazers_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/stargazers","contributors_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/contributors","subscribers_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/subscribers","subscription_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/subscription","commits_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/commits{/sha}","git_commits_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/git/commits{/sha}","comments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/comments{/number}","issue_comment_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/comments{/number}","contents_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/contents/{+path}","compare_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/merges","archive_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/downloads","issues_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues{/number}","pulls_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls{/number}","milestones_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/milestones{/number}","notifications_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/labels{/name}","releases_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/releases{/id}","deployments_url":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/deployments","created_at":"2018-02-19T10:41:25Z","updated_at":"2018-11-15T17:31:39Z","pushed_at":"2018-11-26T12:26:14Z","git_url":"git://github.com/Civil-Service-Human-Resources/lpg-learner-record.git","ssh_url":"git@github.com:Civil-Service-Human-Resources/lpg-learner-record.git","clone_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record.git","svn_url":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record","homepage":null,"size":570,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56"},"html":{"href":"https://github.com/Civil-Service-Human-Resources/lpg-learner-record/pull/56"},"issue":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/56"},"comments":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/Civil-Service-Human-Resources/lpg-learner-record/statuses/46643af1327b1aa37bd3fdef03253e4f8fb92134"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"robleney-kainos"}}