From cf08efa19f84443a9d3f042783b6b250203a872a Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Tue, 16 Oct 2018 09:42:28 +0200 Subject: [PATCH] imporved queries --- graphql/UserProfileQuery.js | 12 ++++++++++++ pages/index.vue | 25 ++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/graphql/UserProfileQuery.js b/graphql/UserProfileQuery.js index d2c37844e..a490fe2de 100644 --- a/graphql/UserProfileQuery.js +++ b/graphql/UserProfileQuery.js @@ -14,7 +14,18 @@ export default gql(` avatar } badgesCount + shoutedCount + commentsCount followingCount + following { + id + name + slug + avatar + followedByCount + contributionsCount + commentsCount + } followedByCount contributionsCount contributions { @@ -28,6 +39,7 @@ export default gql(` image author { User { + id avatar name } diff --git a/pages/index.vue b/pages/index.vue index 97acc7d8c..14f5f64c2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -46,7 +46,7 @@ export default { Post: { query: gql(` query { - Post { + Post(first:10, orderBy: shoutedCount_desc) { id title contentExcerpt @@ -54,34 +54,21 @@ export default { image author { User { + id avatar slug name + contributionsCount + shoutedCount + commentsCount + followedByCount } } - tags { - name - } commentsCount - comments(orderBy: _id_desc) { - id - content - author { - User { - name - } - } - } categories { name } shoutedCount - shoutedBy { - name - friends { - name - } - } } } `),