Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NT-1918: Create GraphQL Query & Fragments #1245

Merged
merged 12 commits into from
May 17, 2021

Conversation

sunday-okpoluaefe
Copy link
Contributor

@sunday-okpoluaefe sunday-okpoluaefe commented May 13, 2021

📲 What

Create GraphQL Query & Fragments

🤔 Why

  • Loads the first 25 Comments

  • Graph QL Query and Fragments are created

🛠 How

  • Created graphql fragmets
fragment comment on Comment {
    id
    author {
       ...user
    }
    body
    deleted
    parentId
    createdAt
}

fragment user on User {
    name
    id
    imageUrl(blur: false, width: 54),
    isCreator
}
fragment pageInfo on PageInfo {
      hasPreviousPage
      hasNextPage
      startCursor
      endCursor
}

  • Created comments query
query GetProjectComments($slug: String!, $cursor: String!){
      project(slug: $slug) {
        collaborators {
          edges {
            node {
              id
              name
            }
          }
        }
        comments(after: $cursor) {
          edges {
            cursor
            node {
              authorBadges
              ...comment
              replies {
                edges {
                cursor
                  node {
                    ...comment
                  }
                }
                pageInfo {
                    ...pageInfo
                 }
                totalCount
              }
            }
          }
          pageInfo {
                  ...pageInfo
           }
          totalCount
        }
      }
   }

👀 See

Trello, screenshots, external resources?

Before 🐛 After 🦋

📋 QA

QA -> You can execute this query directly on https://staging.kickstarter.com/graphiql

query {
	project(slug: "nimble-salon-quality-nails-from-the-comfort-of-your-home") {
    collaborators {
            edges {
              node {
                id
                name
              }
            }
          }
      comments {
        edges {
          cursor
          node {
            authorBadges
            ...comment
            replies {
              edges {
              cursor
                node {
                  ...comment
                }
              }
              pageInfo {
                  ...pageInfo
               }
              totalCount
            }
          }
        }
        pageInfo {
                ...pageInfo
         }
        totalCount
      }
    }
 }

fragment user on User {
    name
    id
    imageUrl(blur: false, width: 54),
    isCreator
}

fragment pageInfo on PageInfo {
      hasPreviousPage
      hasNextPage
      startCursor
      endCursor
}

fragment comment on Comment {
    id
    author {
       ...user
    }
    body
    deleted
    parentId
    createdAt
}

Story 📖

https://kickstarter.atlassian.net/browse/NT-1918

@sunday-okpoluaefe sunday-okpoluaefe marked this pull request as ready for review May 13, 2021 15:45
@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #1245 (c14cc27) into master (a6bff70) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1245   +/-   ##
=========================================
  Coverage     74.79%   74.79%           
  Complexity      734      734           
=========================================
  Files           221      221           
  Lines          6682     6682           
  Branches        403      403           
=========================================
  Hits           4998     4998           
  Misses         1551     1551           
  Partials        133      133           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6bff70...c14cc27. Read the comment docs.

cursor
node {
authorBadges
...comment
Copy link
Contributor

@Arkariang Arkariang May 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with those fragments 👍

Copy link
Contributor

@Arkariang Arkariang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As QA I executed the query on https://staging.kickstarter.com/graphiql and the result of it is the list of comments and the collaborators. Not sure though why we need the collaborators, but if that is also in the acceptance criteria for this ticket disregard my comment and I'll approve it :).
You've done a great work here @sunday-okpoluaefe

QA -> You can execute this query directly on https://staging.kickstarter.com/graphiql

query {
	project(slug: "nimble-salon-quality-nails-from-the-comfort-of-your-home") {
    collaborators {
            edges {
              node {
                id
                name
              }
            }
          }
      comments {
        edges {
          cursor
          node {
            authorBadges
            ...comment
            replies {
              edges {
              cursor
                node {
                  ...comment
                }
              }
              pageInfo {
                  ...pageInfo
               }
              totalCount
            }
          }
        }
        pageInfo {
                ...pageInfo
         }
        totalCount
      }
    }
 }

fragment user on User {
    name
    id
    imageUrl(blur: false, width: 54),
    isCreator
}

fragment pageInfo on PageInfo {
      hasPreviousPage
      hasNextPage
      startCursor
      endCursor
}

fragment comment on Comment {
    id
    author {
       ...user
    }
    body
    deleted
    parentId
    createdAt
}

@sunday-okpoluaefe
Copy link
Contributor Author

As QA I executed the query on https://staging.kickstarter.com/graphiql and the result of it is the list of comments and the collaborators. Not sure though why we need the collaborators, but if that is also in the acceptance criteria for this ticket disregard my comment and I'll approve it :).
You've done a great work here @sunday-okpoluaefe

QA -> You can execute this query directly on https://staging.kickstarter.com/graphiql

query {
	project(slug: "nimble-salon-quality-nails-from-the-comfort-of-your-home") {
    collaborators {
            edges {
              node {
                id
                name
              }
            }
          }
      comments {
        edges {
          cursor
          node {
            authorBadges
            ...comment
            replies {
              edges {
              cursor
                node {
                  ...comment
                }
              }
              pageInfo {
                  ...pageInfo
               }
              totalCount
            }
          }
        }
        pageInfo {
                ...pageInfo
         }
        totalCount
      }
    }
 }

fragment user on User {
    name
    id
    imageUrl(blur: false, width: 54),
    isCreator
}

fragment pageInfo on PageInfo {
      hasPreviousPage
      hasNextPage
      startCursor
      endCursor
}

fragment comment on Comment {
    id
    author {
       ...user
    }
    body
    deleted
    parentId
    createdAt
}

thanks. For the collaborators, I just feel there will be need to have list of participants in the comment. However, I can remove them for now.

@Arkariang Arkariang self-requested a review May 17, 2021 15:45
@sunday-okpoluaefe sunday-okpoluaefe merged commit 0a5d4ba into master May 17, 2021
@sunday-okpoluaefe sunday-okpoluaefe deleted the sunday-nt-1918-graphql-query-fragment branch May 17, 2021 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants