{"action":"created","comment":{"url":"https://api.github.com/repos/voronindev/mbraw/pulls/comments/28231029","id":28231029,"diff_hunk":"@@ -0,0 +1,70 @@\n+package ru.workspace.mbraw.webapp.controllers;\n+\n+\n+import ma.glasnost.orika.MapperFacade;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.http.MediaType;\n+import org.springframework.web.bind.annotation.*;\n+import ru.workspace.mbraw.webapp.dto.DeviceDto;\n+import ru.workspace.mbraw.webapp.pojo.Device;\n+import ru.workspace.mbraw.webapp.services.DeviceService;\n+\n+import java.util.List;\n+\n+@RestController\n+@RequestMapping(value = \"/api/devices\",\n+        produces = MediaType.APPLICATION_JSON_VALUE,\n+        consumes = MediaType.APPLICATION_JSON_VALUE)\n+public class DeviceController {\n+\n+    @Autowired\n+    private DeviceService service;\n+\n+    @Autowired\n+    private MapperFacade mapper;\n+\n+    @RequestMapping(method = RequestMethod.GET)\n+    public List<DeviceDto> list() {\n+        List<Device> list = service.getDevices();\n+\n+        return mapper.mapAsList(list, DeviceDto.class);\n+    }\n+\n+    @RequestMapping(params = {\"limit\", \"offset\"}, method = RequestMethod.GET)\n+    public List<DeviceDto> listWith(@RequestParam Integer limit, @RequestParam Integer offset) {\n+        List<Device> list = service.getDevicesWith(limit, offset);\n+\n+        return mapper.mapAsList(list, DeviceDto.class);\n+    }\n+\n+\n+    @RequestMapping(value = \"/{serial}\", method = RequestMethod.GET)\n+    public DeviceDto device(@PathVariable String serial) {\n+        Device device = service.getDeviceBySerial(serial);\n+\n+        return mapper.map(device, DeviceDto.class);\n+    }\n+\n+    @RequestMapping(method = RequestMethod.POST)\n+    public void add(@RequestBody DeviceDto dto) {\n+        Device device = mapper.map(dto, Device.class);\n+        service.create(device);","path":"src/main/java/ru/workspace/mbraw/webapp/controllers/DeviceController.java","position":51,"original_position":51,"commit_id":"dd928c5bb890ad836980021a61c1821da3451d3c","original_commit_id":"dd928c5bb890ad836980021a61c1821da3451d3c","user":{"login":"idelpivnitskiy","id":3968288,"avatar_url":"https://avatars.githubusercontent.com/u/3968288?v=3","gravatar_id":"","url":"https://api.github.com/users/idelpivnitskiy","html_url":"https://github.com/idelpivnitskiy","followers_url":"https://api.github.com/users/idelpivnitskiy/followers","following_url":"https://api.github.com/users/idelpivnitskiy/following{/other_user}","gists_url":"https://api.github.com/users/idelpivnitskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/idelpivnitskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idelpivnitskiy/subscriptions","organizations_url":"https://api.github.com/users/idelpivnitskiy/orgs","repos_url":"https://api.github.com/users/idelpivnitskiy/repos","events_url":"https://api.github.com/users/idelpivnitskiy/events{/privacy}","received_events_url":"https://api.github.com/users/idelpivnitskiy/received_events","type":"User","site_admin":false},"body":"и как я узнаю id созданной записи?","created_at":"2015-04-13T11:36:05Z","updated_at":"2015-04-13T11:36:05Z","html_url":"https://github.com/voronindev/mbraw/pull/1#discussion_r28231029","pull_request_url":"https://api.github.com/repos/voronindev/mbraw/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/comments/28231029"},"html":{"href":"https://github.com/voronindev/mbraw/pull/1#discussion_r28231029"},"pull_request":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/voronindev/mbraw/pulls/1","id":32586990,"html_url":"https://github.com/voronindev/mbraw/pull/1","diff_url":"https://github.com/voronindev/mbraw/pull/1.diff","patch_url":"https://github.com/voronindev/mbraw/pull/1.patch","issue_url":"https://api.github.com/repos/voronindev/mbraw/issues/1","number":1,"state":"open","locked":false,"title":"hey hey hey","user":{"login":"voronindev","id":10127919,"avatar_url":"https://avatars.githubusercontent.com/u/10127919?v=3","gravatar_id":"","url":"https://api.github.com/users/voronindev","html_url":"https://github.com/voronindev","followers_url":"https://api.github.com/users/voronindev/followers","following_url":"https://api.github.com/users/voronindev/following{/other_user}","gists_url":"https://api.github.com/users/voronindev/gists{/gist_id}","starred_url":"https://api.github.com/users/voronindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronindev/subscriptions","organizations_url":"https://api.github.com/users/voronindev/orgs","repos_url":"https://api.github.com/users/voronindev/repos","events_url":"https://api.github.com/users/voronindev/events{/privacy}","received_events_url":"https://api.github.com/users/voronindev/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-03T12:51:38Z","updated_at":"2015-04-13T11:36:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba020d79498401be04f739dc5ca3e73fad401a9b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/voronindev/mbraw/pulls/1/commits","review_comments_url":"https://api.github.com/repos/voronindev/mbraw/pulls/1/comments","review_comment_url":"https://api.github.com/repos/voronindev/mbraw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/voronindev/mbraw/issues/1/comments","statuses_url":"https://api.github.com/repos/voronindev/mbraw/statuses/dd928c5bb890ad836980021a61c1821da3451d3c","head":{"label":"voronindev:initial","ref":"initial","sha":"dd928c5bb890ad836980021a61c1821da3451d3c","user":{"login":"voronindev","id":10127919,"avatar_url":"https://avatars.githubusercontent.com/u/10127919?v=3","gravatar_id":"","url":"https://api.github.com/users/voronindev","html_url":"https://github.com/voronindev","followers_url":"https://api.github.com/users/voronindev/followers","following_url":"https://api.github.com/users/voronindev/following{/other_user}","gists_url":"https://api.github.com/users/voronindev/gists{/gist_id}","starred_url":"https://api.github.com/users/voronindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronindev/subscriptions","organizations_url":"https://api.github.com/users/voronindev/orgs","repos_url":"https://api.github.com/users/voronindev/repos","events_url":"https://api.github.com/users/voronindev/events{/privacy}","received_events_url":"https://api.github.com/users/voronindev/received_events","type":"User","site_admin":false},"repo":{"id":33362345,"name":"mbraw","full_name":"voronindev/mbraw","owner":{"login":"voronindev","id":10127919,"avatar_url":"https://avatars.githubusercontent.com/u/10127919?v=3","gravatar_id":"","url":"https://api.github.com/users/voronindev","html_url":"https://github.com/voronindev","followers_url":"https://api.github.com/users/voronindev/followers","following_url":"https://api.github.com/users/voronindev/following{/other_user}","gists_url":"https://api.github.com/users/voronindev/gists{/gist_id}","starred_url":"https://api.github.com/users/voronindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronindev/subscriptions","organizations_url":"https://api.github.com/users/voronindev/orgs","repos_url":"https://api.github.com/users/voronindev/repos","events_url":"https://api.github.com/users/voronindev/events{/privacy}","received_events_url":"https://api.github.com/users/voronindev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/voronindev/mbraw","description":"","fork":false,"url":"https://api.github.com/repos/voronindev/mbraw","forks_url":"https://api.github.com/repos/voronindev/mbraw/forks","keys_url":"https://api.github.com/repos/voronindev/mbraw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voronindev/mbraw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voronindev/mbraw/teams","hooks_url":"https://api.github.com/repos/voronindev/mbraw/hooks","issue_events_url":"https://api.github.com/repos/voronindev/mbraw/issues/events{/number}","events_url":"https://api.github.com/repos/voronindev/mbraw/events","assignees_url":"https://api.github.com/repos/voronindev/mbraw/assignees{/user}","branches_url":"https://api.github.com/repos/voronindev/mbraw/branches{/branch}","tags_url":"https://api.github.com/repos/voronindev/mbraw/tags","blobs_url":"https://api.github.com/repos/voronindev/mbraw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voronindev/mbraw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voronindev/mbraw/git/refs{/sha}","trees_url":"https://api.github.com/repos/voronindev/mbraw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voronindev/mbraw/statuses/{sha}","languages_url":"https://api.github.com/repos/voronindev/mbraw/languages","stargazers_url":"https://api.github.com/repos/voronindev/mbraw/stargazers","contributors_url":"https://api.github.com/repos/voronindev/mbraw/contributors","subscribers_url":"https://api.github.com/repos/voronindev/mbraw/subscribers","subscription_url":"https://api.github.com/repos/voronindev/mbraw/subscription","commits_url":"https://api.github.com/repos/voronindev/mbraw/commits{/sha}","git_commits_url":"https://api.github.com/repos/voronindev/mbraw/git/commits{/sha}","comments_url":"https://api.github.com/repos/voronindev/mbraw/comments{/number}","issue_comment_url":"https://api.github.com/repos/voronindev/mbraw/issues/comments{/number}","contents_url":"https://api.github.com/repos/voronindev/mbraw/contents/{+path}","compare_url":"https://api.github.com/repos/voronindev/mbraw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voronindev/mbraw/merges","archive_url":"https://api.github.com/repos/voronindev/mbraw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voronindev/mbraw/downloads","issues_url":"https://api.github.com/repos/voronindev/mbraw/issues{/number}","pulls_url":"https://api.github.com/repos/voronindev/mbraw/pulls{/number}","milestones_url":"https://api.github.com/repos/voronindev/mbraw/milestones{/number}","notifications_url":"https://api.github.com/repos/voronindev/mbraw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voronindev/mbraw/labels{/name}","releases_url":"https://api.github.com/repos/voronindev/mbraw/releases{/id}","created_at":"2015-04-03T12:31:12Z","updated_at":"2015-04-03T12:31:12Z","pushed_at":"2015-04-13T10:30:52Z","git_url":"git://github.com/voronindev/mbraw.git","ssh_url":"git@github.com:voronindev/mbraw.git","clone_url":"https://github.com/voronindev/mbraw.git","svn_url":"https://github.com/voronindev/mbraw","homepage":null,"size":204,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"voronindev:master","ref":"master","sha":"b882ad2ab6573b2d68feaf3ac974bcd46491c2d9","user":{"login":"voronindev","id":10127919,"avatar_url":"https://avatars.githubusercontent.com/u/10127919?v=3","gravatar_id":"","url":"https://api.github.com/users/voronindev","html_url":"https://github.com/voronindev","followers_url":"https://api.github.com/users/voronindev/followers","following_url":"https://api.github.com/users/voronindev/following{/other_user}","gists_url":"https://api.github.com/users/voronindev/gists{/gist_id}","starred_url":"https://api.github.com/users/voronindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronindev/subscriptions","organizations_url":"https://api.github.com/users/voronindev/orgs","repos_url":"https://api.github.com/users/voronindev/repos","events_url":"https://api.github.com/users/voronindev/events{/privacy}","received_events_url":"https://api.github.com/users/voronindev/received_events","type":"User","site_admin":false},"repo":{"id":33362345,"name":"mbraw","full_name":"voronindev/mbraw","owner":{"login":"voronindev","id":10127919,"avatar_url":"https://avatars.githubusercontent.com/u/10127919?v=3","gravatar_id":"","url":"https://api.github.com/users/voronindev","html_url":"https://github.com/voronindev","followers_url":"https://api.github.com/users/voronindev/followers","following_url":"https://api.github.com/users/voronindev/following{/other_user}","gists_url":"https://api.github.com/users/voronindev/gists{/gist_id}","starred_url":"https://api.github.com/users/voronindev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voronindev/subscriptions","organizations_url":"https://api.github.com/users/voronindev/orgs","repos_url":"https://api.github.com/users/voronindev/repos","events_url":"https://api.github.com/users/voronindev/events{/privacy}","received_events_url":"https://api.github.com/users/voronindev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/voronindev/mbraw","description":"","fork":false,"url":"https://api.github.com/repos/voronindev/mbraw","forks_url":"https://api.github.com/repos/voronindev/mbraw/forks","keys_url":"https://api.github.com/repos/voronindev/mbraw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voronindev/mbraw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voronindev/mbraw/teams","hooks_url":"https://api.github.com/repos/voronindev/mbraw/hooks","issue_events_url":"https://api.github.com/repos/voronindev/mbraw/issues/events{/number}","events_url":"https://api.github.com/repos/voronindev/mbraw/events","assignees_url":"https://api.github.com/repos/voronindev/mbraw/assignees{/user}","branches_url":"https://api.github.com/repos/voronindev/mbraw/branches{/branch}","tags_url":"https://api.github.com/repos/voronindev/mbraw/tags","blobs_url":"https://api.github.com/repos/voronindev/mbraw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voronindev/mbraw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voronindev/mbraw/git/refs{/sha}","trees_url":"https://api.github.com/repos/voronindev/mbraw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voronindev/mbraw/statuses/{sha}","languages_url":"https://api.github.com/repos/voronindev/mbraw/languages","stargazers_url":"https://api.github.com/repos/voronindev/mbraw/stargazers","contributors_url":"https://api.github.com/repos/voronindev/mbraw/contributors","subscribers_url":"https://api.github.com/repos/voronindev/mbraw/subscribers","subscription_url":"https://api.github.com/repos/voronindev/mbraw/subscription","commits_url":"https://api.github.com/repos/voronindev/mbraw/commits{/sha}","git_commits_url":"https://api.github.com/repos/voronindev/mbraw/git/commits{/sha}","comments_url":"https://api.github.com/repos/voronindev/mbraw/comments{/number}","issue_comment_url":"https://api.github.com/repos/voronindev/mbraw/issues/comments{/number}","contents_url":"https://api.github.com/repos/voronindev/mbraw/contents/{+path}","compare_url":"https://api.github.com/repos/voronindev/mbraw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voronindev/mbraw/merges","archive_url":"https://api.github.com/repos/voronindev/mbraw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voronindev/mbraw/downloads","issues_url":"https://api.github.com/repos/voronindev/mbraw/issues{/number}","pulls_url":"https://api.github.com/repos/voronindev/mbraw/pulls{/number}","milestones_url":"https://api.github.com/repos/voronindev/mbraw/milestones{/number}","notifications_url":"https://api.github.com/repos/voronindev/mbraw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voronindev/mbraw/labels{/name}","releases_url":"https://api.github.com/repos/voronindev/mbraw/releases{/id}","created_at":"2015-04-03T12:31:12Z","updated_at":"2015-04-03T12:31:12Z","pushed_at":"2015-04-13T10:30:52Z","git_url":"git://github.com/voronindev/mbraw.git","ssh_url":"git@github.com:voronindev/mbraw.git","clone_url":"https://github.com/voronindev/mbraw.git","svn_url":"https://github.com/voronindev/mbraw","homepage":null,"size":204,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/1"},"html":{"href":"https://github.com/voronindev/mbraw/pull/1"},"issue":{"href":"https://api.github.com/repos/voronindev/mbraw/issues/1"},"comments":{"href":"https://api.github.com/repos/voronindev/mbraw/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/voronindev/mbraw/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/voronindev/mbraw/statuses/dd928c5bb890ad836980021a61c1821da3451d3c"}}}}