{"action":"created","comment":{"url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments/221918704","pull_request_review_id":160680508,"id":221918704,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTkxODcwNA==","diff_hunk":"@@ -16,18 +17,25 @@\n \n @Repository\n public class JdbcPlayListDao implements PlayListDao {\n-    private static final int TOP_PLAYLIST_COUNT = 10;\n-    private static final String USER_ID=\"userId\";\n-    private static final String PLAYLIST_ID=\"playlistId\";\n     private final Logger logger = LoggerFactory.getLogger(getClass());\n+    private static final int TOP_PLAYLIST_COUNT = 10;\n+    private static final String USER_ID = \"userId\";\n+    private static final String PLAYLIST_ID = \"playlistId\";\n     private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;\n-    private static final PlayListRowMapper PLAYLIST_ROW_MAPPER = new PlayListRowMapper();\n+    private static final RowMapper<PlayList> PLAYLIST_ROW_MAPPER = new PlayListRowMapper();\n+\n+    private static final String SELECT_FROM_PLAYLIST_CLAUSE = \"SELECT pl.id, pl.title,\" +\n+            \" pl.picture, pl.access, pu.id as liked \" +\n+            \"FROM playlist AS pl \";\n     private static final String GET_PLAYLIST_LIKE_COUNT_SQL = \"SELECT COUNT(*) FROM playlist_user WHERE playlist =:playlistId;\";\n     private static final String GET_USER_LIKE_COUNT_FOR_PLAYLIST_SQL = \"SELECT COUNT(*) FROM playlist_user WHERE playlist =:playlistId AND \\\"user\\\"=:userId ;\";\n     private static final String DELETE_PLAYLIST_LIKE_COUNT_SQL = \"DELETE from playlist_user where playlist=:playlistId and \\\"user\\\"=:userId\";\n     private static final String ADD_PLAYLIST_LIKE_COUNT_SQL = \"INSERT INTO playlist_user (playlist, \\\"user\\\") VALUES (:playlistId,:userId)\";\n-    private static final String GET_TOP_PLAYLIST_SQL = \"SELECT pl.id, pl.title, pl.picture, pl.access FROM playlist AS pl WHERE pl.access='public' limit :limit;\";\n-    private static final String GET_ALL_PLAYLIST_OF_USER_ID_SQL = \"SELECT pl.id, pl.title,pl.picture, pl.access FROM playlist AS pl \" +\n+    private static final String GET_TOP_PLAYLIST_SQL = SELECT_FROM_PLAYLIST_CLAUSE +\n+            \"left join playlist_user pu on pu.user=:userId and pu.playlist=pl.id \" +","path":"src/main/java/com/deezer/dao/jdbc/JdbcPlayListDao.java","position":33,"original_position":33,"commit_id":"b48a97e76b9c9e008e2654704a69aa316ea9df4b","original_commit_id":"b48a97e76b9c9e008e2654704a69aa316ea9df4b","user":{"login":"sonarcloud[bot]","id":39514782,"node_id":"MDM6Qm90Mzk1MTQ3ODI=","avatar_url":"https://avatars2.githubusercontent.com/in/12526?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarcloud%5Bbot%5D","html_url":"https://github.com/apps/sonarcloud","followers_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/followers","following_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/repos","events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Define a constant instead of duplicating this literal \"left join playlist_user pu on pu.user=:userId and pu.playlist=pl.id \" 3 times. ([squid:S1192](https://sonarcloud.io/organizations/dmitriyshalimov-github/rules#rule_key=squid%3AS1192))\n\n[See it in SonarCloud](https://sonarcloud.io/project/issues?id=com.deezer&pullRequest=17&issues=AWYyeldT_XXc3YMrAbEV&open=AWYyeldT_XXc3YMrAbEV)\n\n[ISSUE_KEY]: AWYyeldT_XXc3YMrAbEV","created_at":"2018-10-02T11:50:33Z","updated_at":"2018-10-02T11:50:33Z","html_url":"https://github.com/DmitriyShalimov/Deezer/pull/17#discussion_r221918704","pull_request_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments/221918704"},"html":{"href":"https://github.com/DmitriyShalimov/Deezer/pull/17#discussion_r221918704"},"pull_request":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17","id":219564011,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5NTY0MDEx","html_url":"https://github.com/DmitriyShalimov/Deezer/pull/17","diff_url":"https://github.com/DmitriyShalimov/Deezer/pull/17.diff","patch_url":"https://github.com/DmitriyShalimov/Deezer/pull/17.patch","issue_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/17","number":17,"state":"open","locked":false,"title":"Like dislike ui","user":{"login":"sunnyno","id":11801738,"node_id":"MDQ6VXNlcjExODAxNzM4","avatar_url":"https://avatars0.githubusercontent.com/u/11801738?v=4","gravatar_id":"","url":"https://api.github.com/users/sunnyno","html_url":"https://github.com/sunnyno","followers_url":"https://api.github.com/users/sunnyno/followers","following_url":"https://api.github.com/users/sunnyno/following{/other_user}","gists_url":"https://api.github.com/users/sunnyno/gists{/gist_id}","starred_url":"https://api.github.com/users/sunnyno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunnyno/subscriptions","organizations_url":"https://api.github.com/users/sunnyno/orgs","repos_url":"https://api.github.com/users/sunnyno/repos","events_url":"https://api.github.com/users/sunnyno/events{/privacy}","received_events_url":"https://api.github.com/users/sunnyno/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-02T01:51:06Z","updated_at":"2018-10-02T11:50:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8057f25dabbf7b44f6b24680c10e2416e6049813","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17/commits","review_comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17/comments","review_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/17/comments","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/b48a97e76b9c9e008e2654704a69aa316ea9df4b","head":{"label":"DmitriyShalimov:like-dislike-ui","ref":"like-dislike-ui","sha":"b48a97e76b9c9e008e2654704a69aa316ea9df4b","user":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"repo":{"id":148375558,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgzNzU1NTg=","name":"Deezer","full_name":"DmitriyShalimov/Deezer","private":false,"owner":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/DmitriyShalimov/Deezer","description":null,"fork":false,"url":"https://api.github.com/repos/DmitriyShalimov/Deezer","forks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/forks","keys_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/teams","hooks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/hooks","issue_events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/events{/number}","events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/events","assignees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/assignees{/user}","branches_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/branches{/branch}","tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/tags","blobs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/refs{/sha}","trees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/{sha}","languages_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/languages","stargazers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/stargazers","contributors_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contributors","subscribers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscribers","subscription_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscription","commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/commits{/sha}","git_commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/commits{/sha}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/comments{/number}","issue_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/comments{/number}","contents_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contents/{+path}","compare_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/merges","archive_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/downloads","issues_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues{/number}","pulls_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls{/number}","milestones_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/milestones{/number}","notifications_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/labels{/name}","releases_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/releases{/id}","deployments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/deployments","created_at":"2018-09-11T20:22:44Z","updated_at":"2018-10-01T14:29:14Z","pushed_at":"2018-10-02T11:47:44Z","git_url":"git://github.com/DmitriyShalimov/Deezer.git","ssh_url":"git@github.com:DmitriyShalimov/Deezer.git","clone_url":"https://github.com/DmitriyShalimov/Deezer.git","svn_url":"https://github.com/DmitriyShalimov/Deezer","homepage":null,"size":738,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"DmitriyShalimov:master","ref":"master","sha":"a8ac94dd85e894b658aa72b7f923e2d1c6e35c39","user":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"repo":{"id":148375558,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgzNzU1NTg=","name":"Deezer","full_name":"DmitriyShalimov/Deezer","private":false,"owner":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/DmitriyShalimov/Deezer","description":null,"fork":false,"url":"https://api.github.com/repos/DmitriyShalimov/Deezer","forks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/forks","keys_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/teams","hooks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/hooks","issue_events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/events{/number}","events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/events","assignees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/assignees{/user}","branches_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/branches{/branch}","tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/tags","blobs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/refs{/sha}","trees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/{sha}","languages_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/languages","stargazers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/stargazers","contributors_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contributors","subscribers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscribers","subscription_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscription","commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/commits{/sha}","git_commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/commits{/sha}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/comments{/number}","issue_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/comments{/number}","contents_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contents/{+path}","compare_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/merges","archive_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/downloads","issues_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues{/number}","pulls_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls{/number}","milestones_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/milestones{/number}","notifications_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/labels{/name}","releases_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/releases{/id}","deployments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/deployments","created_at":"2018-09-11T20:22:44Z","updated_at":"2018-10-01T14:29:14Z","pushed_at":"2018-10-02T11:47:44Z","git_url":"git://github.com/DmitriyShalimov/Deezer.git","ssh_url":"git@github.com:DmitriyShalimov/Deezer.git","clone_url":"https://github.com/DmitriyShalimov/Deezer.git","svn_url":"https://github.com/DmitriyShalimov/Deezer","homepage":null,"size":738,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17"},"html":{"href":"https://github.com/DmitriyShalimov/Deezer/pull/17"},"issue":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/17"},"comments":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/b48a97e76b9c9e008e2654704a69aa316ea9df4b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sonarcloud"}}