{"action":"created","comment":{"url":"https://api.github.com/repos/code-squad/java-qna/pulls/comments/165499724","pull_request_review_id":93448565,"id":165499724,"diff_hunk":"@@ -0,0 +1,79 @@\n+package codesquad.web;\n+\n+import codesquad.AnswerNotFoundException;\n+import codesquad.UnAuthorizedException;\n+import codesquad.domain.Answer;\n+import codesquad.domain.Question;\n+import codesquad.domain.User;\n+import codesquad.dto.AnswerDto;\n+import codesquad.security.LoginUser;\n+import codesquad.service.AnswerService;\n+import org.springframework.stereotype.Controller;\n+import org.springframework.ui.Model;\n+import org.springframework.validation.annotation.Validated;\n+import org.springframework.web.bind.annotation.DeleteMapping;\n+import org.springframework.web.bind.annotation.GetMapping;\n+import org.springframework.web.bind.annotation.PathVariable;\n+import org.springframework.web.bind.annotation.PostMapping;\n+import org.springframework.web.bind.annotation.PutMapping;\n+import org.springframework.web.bind.annotation.RequestMapping;\n+\n+import javax.validation.Valid;\n+import javax.validation.constraints.NotNull;\n+\n+@Validated\n+@Controller\n+@RequestMapping(\"/questions/{questionId}/answers\")\n+public class AnswerController {\n+\n+    private final AnswerService answerService;\n+\n+    public AnswerController(AnswerService answerService) {\n+        this.answerService = answerService;\n+    }\n+\n+    @GetMapping(\"/{id}/form\")\n+    public String showForm(@LoginUser User loginUser,\n+                           @PathVariable(\"questionId\") @NotNull Question question,\n+                           @PathVariable long id,\n+                           Model model) {\n+        if (!answerService.isOwnerOfAnswer(loginUser, id)) {\n+            throw new UnAuthorizedException();\n+        }","path":"src/main/java/codesquad/web/AnswerController.java","position":42,"original_position":42,"commit_id":"1280cd5734ef13267b1e8398d97f202bc3ead159","original_commit_id":"1280cd5734ef13267b1e8398d97f202bc3ead159","user":{"login":"javajigi","id":520500,"avatar_url":"https://avatars2.githubusercontent.com/u/520500?v=4","gravatar_id":"","url":"https://api.github.com/users/javajigi","html_url":"https://github.com/javajigi","followers_url":"https://api.github.com/users/javajigi/followers","following_url":"https://api.github.com/users/javajigi/following{/other_user}","gists_url":"https://api.github.com/users/javajigi/gists{/gist_id}","starred_url":"https://api.github.com/users/javajigi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javajigi/subscriptions","organizations_url":"https://api.github.com/users/javajigi/orgs","repos_url":"https://api.github.com/users/javajigi/repos","events_url":"https://api.github.com/users/javajigi/events{/privacy}","received_events_url":"https://api.github.com/users/javajigi/received_events","type":"User","site_admin":false},"body":"댓글은 로그인 사용자면 아무나 쓸수 있어야 하지 않을까요?","created_at":"2018-02-01T21:54:35Z","updated_at":"2018-02-01T22:01:40Z","html_url":"https://github.com/code-squad/java-qna/pull/55#discussion_r165499724","pull_request_url":"https://api.github.com/repos/code-squad/java-qna/pulls/55","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/comments/165499724"},"html":{"href":"https://github.com/code-squad/java-qna/pull/55#discussion_r165499724"},"pull_request":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/code-squad/java-qna/pulls/55","id":166582396,"html_url":"https://github.com/code-squad/java-qna/pull/55","diff_url":"https://github.com/code-squad/java-qna/pull/55.diff","patch_url":"https://github.com/code-squad/java-qna/pull/55.patch","issue_url":"https://api.github.com/repos/code-squad/java-qna/issues/55","number":55,"state":"open","locked":false,"title":"Step3","user":{"login":"Gunju-Ko","id":26369322,"avatar_url":"https://avatars0.githubusercontent.com/u/26369322?v=4","gravatar_id":"","url":"https://api.github.com/users/Gunju-Ko","html_url":"https://github.com/Gunju-Ko","followers_url":"https://api.github.com/users/Gunju-Ko/followers","following_url":"https://api.github.com/users/Gunju-Ko/following{/other_user}","gists_url":"https://api.github.com/users/Gunju-Ko/gists{/gist_id}","starred_url":"https://api.github.com/users/Gunju-Ko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gunju-Ko/subscriptions","organizations_url":"https://api.github.com/users/Gunju-Ko/orgs","repos_url":"https://api.github.com/users/Gunju-Ko/repos","events_url":"https://api.github.com/users/Gunju-Ko/events{/privacy}","received_events_url":"https://api.github.com/users/Gunju-Ko/received_events","type":"User","site_admin":false},"body":"Step 3 요구사항 구현했습니다.\r\n원래는 Answer와 관련된 것들을 QnaSerivce에 구현했어야 하는데... 제가 그걸 인지 못하고 있다가 개발이 끝나고 알았습니다 ㅠㅠ 그래서 일단 QnaService -> QuestionService로 바꾸었습니다. (AnswerService를 그냥 습관처럼 구현해버렸습니다 ㅠㅠ) 혹시라도 이렇게 구현하면 안되면 바로 수정하겠습니다.\r\n\r\n그리고 질문 사항이 있는데요.\r\n1. UnAuthenticationException과 UnAuthorizedException이 살짝 헷갈리는데요..\r\nUnAuthenticationException : 로그인은 되었지만 해당 리소스에 권한이 없다.\r\nUnAuthorizedException : 로그인 자체가 안되었다.\r\n위의 처럼 이해하는게 맞나요? 그리고 UnAuthenticationException이 Runtime Exception이 아닌 이유가 있을까요?\r\n\r\n2. 제가 테스트 코드에서 데이터 수정이 일어나는 부분에서 @DirtiesContext 어노테이션을 사용했더니 테스트가 좀 느려지더라고요... 그렇다고 @DirtiesContext를 사용안하면 다른 테스트에 영향을 줄 수 있을거 같은데.. 혹시 @DirtiesContext에 대해서는 어떻게 생각하시나요? 더 좋은 방법이 있을까요? (제가 생성하거나 수정한 데이터를 다시 원복해야 할까요...)\r\n\r\n감사합니다.","created_at":"2018-02-01T16:15:31Z","updated_at":"2018-02-01T22:01:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a40bf37d26c921cdd01b882c7ce4a8ae2453e9f3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/code-squad/java-qna/pulls/55/commits","review_comments_url":"https://api.github.com/repos/code-squad/java-qna/pulls/55/comments","review_comment_url":"https://api.github.com/repos/code-squad/java-qna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-squad/java-qna/issues/55/comments","statuses_url":"https://api.github.com/repos/code-squad/java-qna/statuses/1280cd5734ef13267b1e8398d97f202bc3ead159","head":{"label":"Gunju-Ko:step3","ref":"step3","sha":"1280cd5734ef13267b1e8398d97f202bc3ead159","user":{"login":"Gunju-Ko","id":26369322,"avatar_url":"https://avatars0.githubusercontent.com/u/26369322?v=4","gravatar_id":"","url":"https://api.github.com/users/Gunju-Ko","html_url":"https://github.com/Gunju-Ko","followers_url":"https://api.github.com/users/Gunju-Ko/followers","following_url":"https://api.github.com/users/Gunju-Ko/following{/other_user}","gists_url":"https://api.github.com/users/Gunju-Ko/gists{/gist_id}","starred_url":"https://api.github.com/users/Gunju-Ko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gunju-Ko/subscriptions","organizations_url":"https://api.github.com/users/Gunju-Ko/orgs","repos_url":"https://api.github.com/users/Gunju-Ko/repos","events_url":"https://api.github.com/users/Gunju-Ko/events{/privacy}","received_events_url":"https://api.github.com/users/Gunju-Ko/received_events","type":"User","site_admin":false},"repo":{"id":119136524,"name":"java-qna","full_name":"Gunju-Ko/java-qna","owner":{"login":"Gunju-Ko","id":26369322,"avatar_url":"https://avatars0.githubusercontent.com/u/26369322?v=4","gravatar_id":"","url":"https://api.github.com/users/Gunju-Ko","html_url":"https://github.com/Gunju-Ko","followers_url":"https://api.github.com/users/Gunju-Ko/followers","following_url":"https://api.github.com/users/Gunju-Ko/following{/other_user}","gists_url":"https://api.github.com/users/Gunju-Ko/gists{/gist_id}","starred_url":"https://api.github.com/users/Gunju-Ko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gunju-Ko/subscriptions","organizations_url":"https://api.github.com/users/Gunju-Ko/orgs","repos_url":"https://api.github.com/users/Gunju-Ko/repos","events_url":"https://api.github.com/users/Gunju-Ko/events{/privacy}","received_events_url":"https://api.github.com/users/Gunju-Ko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Gunju-Ko/java-qna","description":"질문답변 게시판 구현을 위한 저장소","fork":true,"url":"https://api.github.com/repos/Gunju-Ko/java-qna","forks_url":"https://api.github.com/repos/Gunju-Ko/java-qna/forks","keys_url":"https://api.github.com/repos/Gunju-Ko/java-qna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Gunju-Ko/java-qna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Gunju-Ko/java-qna/teams","hooks_url":"https://api.github.com/repos/Gunju-Ko/java-qna/hooks","issue_events_url":"https://api.github.com/repos/Gunju-Ko/java-qna/issues/events{/number}","events_url":"https://api.github.com/repos/Gunju-Ko/java-qna/events","assignees_url":"https://api.github.com/repos/Gunju-Ko/java-qna/assignees{/user}","branches_url":"https://api.github.com/repos/Gunju-Ko/java-qna/branches{/branch}","tags_url":"https://api.github.com/repos/Gunju-Ko/java-qna/tags","blobs_url":"https://api.github.com/repos/Gunju-Ko/java-qna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Gunju-Ko/java-qna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Gunju-Ko/java-qna/git/refs{/sha}","trees_url":"https://api.github.com/repos/Gunju-Ko/java-qna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Gunju-Ko/java-qna/statuses/{sha}","languages_url":"https://api.github.com/repos/Gunju-Ko/java-qna/languages","stargazers_url":"https://api.github.com/repos/Gunju-Ko/java-qna/stargazers","contributors_url":"https://api.github.com/repos/Gunju-Ko/java-qna/contributors","subscribers_url":"https://api.github.com/repos/Gunju-Ko/java-qna/subscribers","subscription_url":"https://api.github.com/repos/Gunju-Ko/java-qna/subscription","commits_url":"https://api.github.com/repos/Gunju-Ko/java-qna/commits{/sha}","git_commits_url":"https://api.github.com/repos/Gunju-Ko/java-qna/git/commits{/sha}","comments_url":"https://api.github.com/repos/Gunju-Ko/java-qna/comments{/number}","issue_comment_url":"https://api.github.com/repos/Gunju-Ko/java-qna/issues/comments{/number}","contents_url":"https://api.github.com/repos/Gunju-Ko/java-qna/contents/{+path}","compare_url":"https://api.github.com/repos/Gunju-Ko/java-qna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Gunju-Ko/java-qna/merges","archive_url":"https://api.github.com/repos/Gunju-Ko/java-qna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Gunju-Ko/java-qna/downloads","issues_url":"https://api.github.com/repos/Gunju-Ko/java-qna/issues{/number}","pulls_url":"https://api.github.com/repos/Gunju-Ko/java-qna/pulls{/number}","milestones_url":"https://api.github.com/repos/Gunju-Ko/java-qna/milestones{/number}","notifications_url":"https://api.github.com/repos/Gunju-Ko/java-qna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Gunju-Ko/java-qna/labels{/name}","releases_url":"https://api.github.com/repos/Gunju-Ko/java-qna/releases{/id}","deployments_url":"https://api.github.com/repos/Gunju-Ko/java-qna/deployments","created_at":"2018-01-27T05:38:37Z","updated_at":"2018-01-27T05:38:39Z","pushed_at":"2018-02-01T16:03:27Z","git_url":"git://github.com/Gunju-Ko/java-qna.git","ssh_url":"git@github.com:Gunju-Ko/java-qna.git","clone_url":"https://github.com/Gunju-Ko/java-qna.git","svn_url":"https://github.com/Gunju-Ko/java-qna","homepage":null,"size":411,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"code-squad:Gunju-Ko","ref":"Gunju-Ko","sha":"2cf44a8147455d370e822b906a497f2499229b10","user":{"login":"code-squad","id":22832280,"avatar_url":"https://avatars2.githubusercontent.com/u/22832280?v=4","gravatar_id":"","url":"https://api.github.com/users/code-squad","html_url":"https://github.com/code-squad","followers_url":"https://api.github.com/users/code-squad/followers","following_url":"https://api.github.com/users/code-squad/following{/other_user}","gists_url":"https://api.github.com/users/code-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/code-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-squad/subscriptions","organizations_url":"https://api.github.com/users/code-squad/orgs","repos_url":"https://api.github.com/users/code-squad/repos","events_url":"https://api.github.com/users/code-squad/events{/privacy}","received_events_url":"https://api.github.com/users/code-squad/received_events","type":"Organization","site_admin":false},"repo":{"id":109669791,"name":"java-qna","full_name":"code-squad/java-qna","owner":{"login":"code-squad","id":22832280,"avatar_url":"https://avatars2.githubusercontent.com/u/22832280?v=4","gravatar_id":"","url":"https://api.github.com/users/code-squad","html_url":"https://github.com/code-squad","followers_url":"https://api.github.com/users/code-squad/followers","following_url":"https://api.github.com/users/code-squad/following{/other_user}","gists_url":"https://api.github.com/users/code-squad/gists{/gist_id}","starred_url":"https://api.github.com/users/code-squad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-squad/subscriptions","organizations_url":"https://api.github.com/users/code-squad/orgs","repos_url":"https://api.github.com/users/code-squad/repos","events_url":"https://api.github.com/users/code-squad/events{/privacy}","received_events_url":"https://api.github.com/users/code-squad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-squad/java-qna","description":"질문답변 게시판 구현을 위한 저장소","fork":false,"url":"https://api.github.com/repos/code-squad/java-qna","forks_url":"https://api.github.com/repos/code-squad/java-qna/forks","keys_url":"https://api.github.com/repos/code-squad/java-qna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-squad/java-qna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-squad/java-qna/teams","hooks_url":"https://api.github.com/repos/code-squad/java-qna/hooks","issue_events_url":"https://api.github.com/repos/code-squad/java-qna/issues/events{/number}","events_url":"https://api.github.com/repos/code-squad/java-qna/events","assignees_url":"https://api.github.com/repos/code-squad/java-qna/assignees{/user}","branches_url":"https://api.github.com/repos/code-squad/java-qna/branches{/branch}","tags_url":"https://api.github.com/repos/code-squad/java-qna/tags","blobs_url":"https://api.github.com/repos/code-squad/java-qna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-squad/java-qna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-squad/java-qna/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-squad/java-qna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-squad/java-qna/statuses/{sha}","languages_url":"https://api.github.com/repos/code-squad/java-qna/languages","stargazers_url":"https://api.github.com/repos/code-squad/java-qna/stargazers","contributors_url":"https://api.github.com/repos/code-squad/java-qna/contributors","subscribers_url":"https://api.github.com/repos/code-squad/java-qna/subscribers","subscription_url":"https://api.github.com/repos/code-squad/java-qna/subscription","commits_url":"https://api.github.com/repos/code-squad/java-qna/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-squad/java-qna/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-squad/java-qna/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-squad/java-qna/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-squad/java-qna/contents/{+path}","compare_url":"https://api.github.com/repos/code-squad/java-qna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-squad/java-qna/merges","archive_url":"https://api.github.com/repos/code-squad/java-qna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-squad/java-qna/downloads","issues_url":"https://api.github.com/repos/code-squad/java-qna/issues{/number}","pulls_url":"https://api.github.com/repos/code-squad/java-qna/pulls{/number}","milestones_url":"https://api.github.com/repos/code-squad/java-qna/milestones{/number}","notifications_url":"https://api.github.com/repos/code-squad/java-qna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-squad/java-qna/labels{/name}","releases_url":"https://api.github.com/repos/code-squad/java-qna/releases{/id}","deployments_url":"https://api.github.com/repos/code-squad/java-qna/deployments","created_at":"2017-11-06T08:49:28Z","updated_at":"2017-12-16T01:40:03Z","pushed_at":"2018-02-01T21:41:15Z","git_url":"git://github.com/code-squad/java-qna.git","ssh_url":"git@github.com:code-squad/java-qna.git","clone_url":"https://github.com/code-squad/java-qna.git","svn_url":"https://github.com/code-squad/java-qna","homepage":null,"size":541,"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":22,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":22,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/55"},"html":{"href":"https://github.com/code-squad/java-qna/pull/55"},"issue":{"href":"https://api.github.com/repos/code-squad/java-qna/issues/55"},"comments":{"href":"https://api.github.com/repos/code-squad/java-qna/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-squad/java-qna/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/code-squad/java-qna/statuses/1280cd5734ef13267b1e8398d97f202bc3ead159"}},"author_association":"NONE"}}
{"actor":{"display_login":"javajigi"}}