{"action":"created","comment":{"url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/comments/241063687","pull_request_review_id":184241438,"id":241063687,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTA2MzY4Nw==","diff_hunk":"@@ -1,45 +1,61 @@\n package com.women.online.shop.controllers;\n \n import com.women.online.shop.controllers.dto.UserDto;\n+import com.women.online.shop.controllers.mappers.UserMapper;\n+import com.women.online.shop.entities.Address;\n import com.women.online.shop.entities.Name;\n import com.women.online.shop.entities.User;\n import com.women.online.shop.repositoties.UserRepository;\n import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.http.HttpStatus;\n import org.springframework.http.ResponseEntity;\n-import org.springframework.web.bind.annotation.GetMapping;\n-import org.springframework.web.bind.annotation.PostMapping;\n-import org.springframework.web.bind.annotation.RequestBody;\n-import org.springframework.web.bind.annotation.RestController;\n+import org.springframework.web.bind.annotation.*;\n \n import javax.annotation.PostConstruct;\n import java.util.List;\n+import java.util.Optional;\n \n @RestController\n public class UserController {\n \n-  private final UserRepository userRepository;\n-\n-  public UserController(@Autowired UserRepository userRepository) {\n-    this.userRepository = userRepository;\n-  }\n-\n-  @PostMapping(\"/users\")\n-  public void create(@RequestBody UserDto userDto) {\n-    final User user =\n-        new User(new Name(userDto.getFirstName(), null, userDto.getLastName()), userDto.getEmail());\n-    userRepository.save(user);\n-  }\n-\n-  @GetMapping(\"/users\")\n-  public ResponseEntity<List<User>> getUsers() {\n-    final List<User> all = userRepository.findAll();\n-    return ResponseEntity.ok(all);\n-  }\n-\n-  // todo add Adress to user, User getByID, delete; Product, UserOrder;\n-\n-  @PostConstruct\n-  public void postConstract() {\n-    System.out.println(\"PostConstruct\");\n-  }\n+    private final UserRepository userRepository;\n+\n+    public UserController(@Autowired UserRepository userRepository) {\n+        this.userRepository = userRepository;\n+    }\n+\n+    @PostMapping(\"/users\")\n+    public ResponseEntity<UserDto> create(@RequestBody UserDto dto) {\n+        User user = UserMapper.convertToEntity(dto);\n+        userRepository.save(user);\n+        UserDto userDto = UserMapper.convertToDto(user);\n+        return new ResponseEntity<>(userDto, HttpStatus.CREATED);\n+    }\n+\n+    @GetMapping(\"/users\")\n+    public ResponseEntity<List<User>> getUsers() {\n+        List<User> users = userRepository.findAll();\n+        return ResponseEntity.ok(users);\n+    }\n+\n+    @GetMapping(\"/users/{id}\")\n+    public ResponseEntity<Optional<User>> getUser(@PathVariable String id) {","path":"src/main/java/com/women/online/shop/controllers/UserController.java","position":71,"original_position":71,"commit_id":"c078132590062ee8715741941686001a901cb8c1","original_commit_id":"c078132590062ee8715741941686001a901cb8c1","user":{"login":"SofiaVynnytska","id":14924867,"node_id":"MDQ6VXNlcjE0OTI0ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/14924867?v=4","gravatar_id":"","url":"https://api.github.com/users/SofiaVynnytska","html_url":"https://github.com/SofiaVynnytska","followers_url":"https://api.github.com/users/SofiaVynnytska/followers","following_url":"https://api.github.com/users/SofiaVynnytska/following{/other_user}","gists_url":"https://api.github.com/users/SofiaVynnytska/gists{/gist_id}","starred_url":"https://api.github.com/users/SofiaVynnytska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SofiaVynnytska/subscriptions","organizations_url":"https://api.github.com/users/SofiaVynnytska/orgs","repos_url":"https://api.github.com/users/SofiaVynnytska/repos","events_url":"https://api.github.com/users/SofiaVynnytska/events{/privacy}","received_events_url":"https://api.github.com/users/SofiaVynnytska/received_events","type":"User","site_admin":false},"body":"видали Optional","created_at":"2018-12-12T15:36:56Z","updated_at":"2018-12-12T15:36:57Z","html_url":"https://github.com/SofiaVynnytska/women-online-shop/pull/13#discussion_r241063687","pull_request_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/comments/241063687"},"html":{"href":"https://github.com/SofiaVynnytska/women-online-shop/pull/13#discussion_r241063687"},"pull_request":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13","id":237067440,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MDY3NDQw","html_url":"https://github.com/SofiaVynnytska/women-online-shop/pull/13","diff_url":"https://github.com/SofiaVynnytska/women-online-shop/pull/13.diff","patch_url":"https://github.com/SofiaVynnytska/women-online-shop/pull/13.patch","issue_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/13","number":13,"state":"open","locked":false,"title":"Changed files UserDto and UserController","user":{"login":"Lena1711","id":33844646,"node_id":"MDQ6VXNlcjMzODQ0NjQ2","avatar_url":"https://avatars3.githubusercontent.com/u/33844646?v=4","gravatar_id":"","url":"https://api.github.com/users/Lena1711","html_url":"https://github.com/Lena1711","followers_url":"https://api.github.com/users/Lena1711/followers","following_url":"https://api.github.com/users/Lena1711/following{/other_user}","gists_url":"https://api.github.com/users/Lena1711/gists{/gist_id}","starred_url":"https://api.github.com/users/Lena1711/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lena1711/subscriptions","organizations_url":"https://api.github.com/users/Lena1711/orgs","repos_url":"https://api.github.com/users/Lena1711/repos","events_url":"https://api.github.com/users/Lena1711/events{/privacy}","received_events_url":"https://api.github.com/users/Lena1711/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-08T13:12:32Z","updated_at":"2018-12-12T15:36:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89495d860fe5dca557c89534c7ce309cf8b8b3fb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13/commits","review_comments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13/comments","review_comment_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/13/comments","statuses_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/statuses/c078132590062ee8715741941686001a901cb8c1","head":{"label":"SofiaVynnytska:Category","ref":"Category","sha":"c078132590062ee8715741941686001a901cb8c1","user":{"login":"SofiaVynnytska","id":14924867,"node_id":"MDQ6VXNlcjE0OTI0ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/14924867?v=4","gravatar_id":"","url":"https://api.github.com/users/SofiaVynnytska","html_url":"https://github.com/SofiaVynnytska","followers_url":"https://api.github.com/users/SofiaVynnytska/followers","following_url":"https://api.github.com/users/SofiaVynnytska/following{/other_user}","gists_url":"https://api.github.com/users/SofiaVynnytska/gists{/gist_id}","starred_url":"https://api.github.com/users/SofiaVynnytska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SofiaVynnytska/subscriptions","organizations_url":"https://api.github.com/users/SofiaVynnytska/orgs","repos_url":"https://api.github.com/users/SofiaVynnytska/repos","events_url":"https://api.github.com/users/SofiaVynnytska/events{/privacy}","received_events_url":"https://api.github.com/users/SofiaVynnytska/received_events","type":"User","site_admin":false},"repo":{"id":153923717,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM5MjM3MTc=","name":"women-online-shop","full_name":"SofiaVynnytska/women-online-shop","private":false,"owner":{"login":"SofiaVynnytska","id":14924867,"node_id":"MDQ6VXNlcjE0OTI0ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/14924867?v=4","gravatar_id":"","url":"https://api.github.com/users/SofiaVynnytska","html_url":"https://github.com/SofiaVynnytska","followers_url":"https://api.github.com/users/SofiaVynnytska/followers","following_url":"https://api.github.com/users/SofiaVynnytska/following{/other_user}","gists_url":"https://api.github.com/users/SofiaVynnytska/gists{/gist_id}","starred_url":"https://api.github.com/users/SofiaVynnytska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SofiaVynnytska/subscriptions","organizations_url":"https://api.github.com/users/SofiaVynnytska/orgs","repos_url":"https://api.github.com/users/SofiaVynnytska/repos","events_url":"https://api.github.com/users/SofiaVynnytska/events{/privacy}","received_events_url":"https://api.github.com/users/SofiaVynnytska/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SofiaVynnytska/women-online-shop","description":null,"fork":false,"url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop","forks_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/forks","keys_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/teams","hooks_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/hooks","issue_events_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/events{/number}","events_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/events","assignees_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/assignees{/user}","branches_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/branches{/branch}","tags_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/tags","blobs_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/refs{/sha}","trees_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/statuses/{sha}","languages_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/languages","stargazers_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/stargazers","contributors_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/contributors","subscribers_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/subscribers","subscription_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/subscription","commits_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/commits{/sha}","git_commits_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/commits{/sha}","comments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/comments{/number}","issue_comment_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/comments{/number}","contents_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/contents/{+path}","compare_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/merges","archive_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/downloads","issues_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues{/number}","pulls_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls{/number}","milestones_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/milestones{/number}","notifications_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/labels{/name}","releases_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/releases{/id}","deployments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/deployments","created_at":"2018-10-20T16:10:23Z","updated_at":"2018-12-12T15:35:21Z","pushed_at":"2018-12-12T15:35:25Z","git_url":"git://github.com/SofiaVynnytska/women-online-shop.git","ssh_url":"git@github.com:SofiaVynnytska/women-online-shop.git","clone_url":"https://github.com/SofiaVynnytska/women-online-shop.git","svn_url":"https://github.com/SofiaVynnytska/women-online-shop","homepage":null,"size":90,"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":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"SofiaVynnytska:master","ref":"master","sha":"36f9bf4d9579ccb2513bcbef3296286b370ab691","user":{"login":"SofiaVynnytska","id":14924867,"node_id":"MDQ6VXNlcjE0OTI0ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/14924867?v=4","gravatar_id":"","url":"https://api.github.com/users/SofiaVynnytska","html_url":"https://github.com/SofiaVynnytska","followers_url":"https://api.github.com/users/SofiaVynnytska/followers","following_url":"https://api.github.com/users/SofiaVynnytska/following{/other_user}","gists_url":"https://api.github.com/users/SofiaVynnytska/gists{/gist_id}","starred_url":"https://api.github.com/users/SofiaVynnytska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SofiaVynnytska/subscriptions","organizations_url":"https://api.github.com/users/SofiaVynnytska/orgs","repos_url":"https://api.github.com/users/SofiaVynnytska/repos","events_url":"https://api.github.com/users/SofiaVynnytska/events{/privacy}","received_events_url":"https://api.github.com/users/SofiaVynnytska/received_events","type":"User","site_admin":false},"repo":{"id":153923717,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM5MjM3MTc=","name":"women-online-shop","full_name":"SofiaVynnytska/women-online-shop","private":false,"owner":{"login":"SofiaVynnytska","id":14924867,"node_id":"MDQ6VXNlcjE0OTI0ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/14924867?v=4","gravatar_id":"","url":"https://api.github.com/users/SofiaVynnytska","html_url":"https://github.com/SofiaVynnytska","followers_url":"https://api.github.com/users/SofiaVynnytska/followers","following_url":"https://api.github.com/users/SofiaVynnytska/following{/other_user}","gists_url":"https://api.github.com/users/SofiaVynnytska/gists{/gist_id}","starred_url":"https://api.github.com/users/SofiaVynnytska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SofiaVynnytska/subscriptions","organizations_url":"https://api.github.com/users/SofiaVynnytska/orgs","repos_url":"https://api.github.com/users/SofiaVynnytska/repos","events_url":"https://api.github.com/users/SofiaVynnytska/events{/privacy}","received_events_url":"https://api.github.com/users/SofiaVynnytska/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SofiaVynnytska/women-online-shop","description":null,"fork":false,"url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop","forks_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/forks","keys_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/teams","hooks_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/hooks","issue_events_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/events{/number}","events_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/events","assignees_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/assignees{/user}","branches_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/branches{/branch}","tags_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/tags","blobs_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/refs{/sha}","trees_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/statuses/{sha}","languages_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/languages","stargazers_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/stargazers","contributors_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/contributors","subscribers_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/subscribers","subscription_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/subscription","commits_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/commits{/sha}","git_commits_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/git/commits{/sha}","comments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/comments{/number}","issue_comment_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/comments{/number}","contents_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/contents/{+path}","compare_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/merges","archive_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/downloads","issues_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues{/number}","pulls_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls{/number}","milestones_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/milestones{/number}","notifications_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/labels{/name}","releases_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/releases{/id}","deployments_url":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/deployments","created_at":"2018-10-20T16:10:23Z","updated_at":"2018-12-12T15:35:21Z","pushed_at":"2018-12-12T15:35:25Z","git_url":"git://github.com/SofiaVynnytska/women-online-shop.git","ssh_url":"git@github.com:SofiaVynnytska/women-online-shop.git","clone_url":"https://github.com/SofiaVynnytska/women-online-shop.git","svn_url":"https://github.com/SofiaVynnytska/women-online-shop","homepage":null,"size":90,"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":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13"},"html":{"href":"https://github.com/SofiaVynnytska/women-online-shop/pull/13"},"issue":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/13"},"comments":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/SofiaVynnytska/women-online-shop/statuses/c078132590062ee8715741941686001a901cb8c1"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"SofiaVynnytska"}}