{"action":"created","comment":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/199185643","pull_request_review_id":133259338,"id":199185643,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTE4NTY0Mw==","diff_hunk":"@@ -0,0 +1,136 @@\n+package com.prisma.api.connector.jdbc.database\n+\n+import com.prisma.api.connector._\n+import com.prisma.gc_values.{GCValue, IdGCValue}\n+import com.prisma.shared.models.{Model, RelationField, ScalarField, Schema}\n+import slick.jdbc.PositionedParameters\n+\n+trait NodeManyQueries extends BuilderBase with LimitClauseBuilder {\n+  import slickDatabase.profile.api._\n+\n+  def getNodes(\n+      model: Model,\n+      args: Option[QueryArguments],\n+      overrideMaxNodeCount: Option[Int] = None\n+  ): DBIO[ResolverResult[PrismaNode]] = {\n+    val builder = ModelQueryBuilder(slickDatabase, schemaName, model, args)\n+    queryToDBIO(builder.query)(\n+      setParams = pp => SetParams.setQueryArgs(pp, args),\n+      readResult = { rs =>\n+        val result = rs.readWith(readsPrismaNode(model))\n+        ResolverResult(args, result)\n+      }\n+    )\n+  }\n+\n+  def getRelatedNodes(\n+      schema: Schema,\n+      fromField: RelationField,\n+      fromNodeIds: Vector[IdGCValue],\n+      args: Option[QueryArguments]\n+  ): DBIO[Vector[ResolverResult[PrismaNodeWithParent]]] = {\n+    if (isMySql && args.exists(_.isWithPagination)) {\n+      selectAllFromRelatedWithPaginationForMySQL(schema, fromField, fromNodeIds, args)\n+    } else {\n+      val builder = RelatedModelsQueryBuilder(slickDatabase, schemaName, fromField, args, fromNodeIds)\n+      val query   = if (args.exists(_.isWithPagination)) builder.queryWithPagination else builder.queryWithoutPagination\n+\n+      queryToDBIO(query)(\n+        setParams = { pp =>\n+          fromNodeIds.foreach(pp.setGcValue)\n+          val filter = args.flatMap(_.filter)\n+          filter.foreach(filter => SetParams.setFilter(pp, filter))\n+\n+          if (args.get.after.isDefined) {\n+            pp.setString(args.get.after.get)\n+            pp.setString(args.get.after.get)\n+          }\n+\n+          if (args.get.before.isDefined) {\n+            pp.setString(args.get.before.get)\n+            pp.setString(args.get.before.get)\n+          }\n+\n+          if (args.exists(_.isWithPagination)) {\n+            val params = limitClauseForWindowFunction(args)\n+            pp.setInt(params._1)\n+            pp.setInt(params._2)\n+          }\n+        },\n+        readResult = { rs =>\n+          val result              = rs.readWith(readPrismaNodeWithParent(fromField))\n+          val itemGroupsByModelId = result.groupBy(_.parentId)\n+          fromNodeIds.map { id =>\n+            itemGroupsByModelId.find(_._1 == id) match {\n+              case Some((_, itemsForId)) => ResolverResult(args, itemsForId, parentModelId = Some(id))\n+              case None                  => ResolverResult(Vector.empty[PrismaNodeWithParent], hasPreviousPage = false, hasNextPage = false, parentModelId = Some(id))\n+            }\n+          }\n+        }\n+      )\n+    }\n+  }\n+\n+  private def selectAllFromRelatedWithPaginationForMySQL(","path":"server/connectors/api-connector-jdbc/src/main/scala/com/prisma/api/connector/jdbc/database/NodeManyQueries.scala","position":74,"original_position":74,"commit_id":"dd82681ed7584505d033a82909071bb39a63b04a","original_commit_id":"dd82681ed7584505d033a82909071bb39a63b04a","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Method is longer than 50 lines](https://app.codacy.com/app/graphcool/prisma/pullRequest?prid=1792053)","created_at":"2018-06-29T14:53:47Z","updated_at":"2018-06-29T14:53:47Z","html_url":"https://github.com/prismagraphql/prisma/pull/2647#discussion_r199185643","pull_request_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/199185643"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2647#discussion_r199185643"},"pull_request":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647"}}},"pull_request":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647","id":195508855,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NTA4ODU1","html_url":"https://github.com/prismagraphql/prisma/pull/2647","diff_url":"https://github.com/prismagraphql/prisma/pull/2647.diff","patch_url":"https://github.com/prismagraphql/prisma/pull/2647.patch","issue_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2647","number":2647,"state":"open","locked":false,"title":"[WIP] refactor mutaction hierarchy","user":{"login":"mavilein","id":2470881,"node_id":"MDQ6VXNlcjI0NzA4ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/2470881?v=4","gravatar_id":"","url":"https://api.github.com/users/mavilein","html_url":"https://github.com/mavilein","followers_url":"https://api.github.com/users/mavilein/followers","following_url":"https://api.github.com/users/mavilein/following{/other_user}","gists_url":"https://api.github.com/users/mavilein/gists{/gist_id}","starred_url":"https://api.github.com/users/mavilein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavilein/subscriptions","organizations_url":"https://api.github.com/users/mavilein/orgs","repos_url":"https://api.github.com/users/mavilein/repos","events_url":"https://api.github.com/users/mavilein/events{/privacy}","received_events_url":"https://api.github.com/users/mavilein/received_events","type":"User","site_admin":false},"body":null,"created_at":"2018-06-18T12:28:29Z","updated_at":"2018-06-29T14:53:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6690d898c032e40a20af9879b5cc2371d7658a08","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647/commits","review_comments_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647/comments","review_comment_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2647/comments","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/dd82681ed7584505d033a82909071bb39a63b04a","head":{"label":"prismagraphql:refactor-mutaction-hierarchy","ref":"refactor-mutaction-hierarchy","sha":"dd82681ed7584505d033a82909071bb39a63b04a","user":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"node_id":"MDEwOlJlcG9zaXRvcnk2OTE2NDE5Ng==","name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-06-29T12:26:00Z","pushed_at":"2018-06-29T14:50:15Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":18594,"stargazers_count":9079,"watchers_count":9079,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":512,"mirror_url":null,"archived":false,"open_issues_count":478,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":512,"open_issues":478,"watchers":9079,"default_branch":"master"}},"base":{"label":"prismagraphql:alpha","ref":"alpha","sha":"7f2945cf995808a6a4655e47cac57cfdc0b08026","user":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"node_id":"MDEwOlJlcG9zaXRvcnk2OTE2NDE5Ng==","name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-06-29T12:26:00Z","pushed_at":"2018-06-29T14:50:15Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":18594,"stargazers_count":9079,"watchers_count":9079,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":512,"mirror_url":null,"archived":false,"open_issues_count":478,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":512,"open_issues":478,"watchers":9079,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2647"},"issue":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2647"},"comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2647/comments"},"review_comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647/comments"},"review_comment":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2647/commits"},"statuses":{"href":"https://api.github.com/repos/prismagraphql/prisma/statuses/dd82681ed7584505d033a82909071bb39a63b04a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}