You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
lee 4e712d15ed corrections and adding GraphiQL for the students to use 4 years ago
..
audit graphql project 4 years ago
README.md corrections and adding GraphiQL for the students to use 4 years ago
index.html corrections and adding GraphiQL for the students to use 4 years ago

README.md

GraphQL

Objectives

The objective of this project is to learn the query language graphQL by creating your profile page. It will be provided,
by the platform, a graphQL endpoint that is connected to the database. So you can query this endpoint to obtain the information you desire.
Note that for security reasons some tables are private and some are public, you will only be provided with certain content.

Your profile must have at least 3 sections of content at your choice, for example:

  • Basic user identification
  • XP amount
  • level
  • grades
  • audits
  • skills

Beside those sections it will have a mandatory section for the generation of statistic graphs.

Instructions

You will have to create a profile UI where you can see your own school information. This information/data is present on the graphQL endpoint, where you will have to query it.

For the UI it will be up to you to design it. But have in mind the principles of a good UI.
Your UI will have a statistic section where you can generate graphs to see more about your journey and achievements on the school. This graphs must be done using SVG.

Here are some combination that you will be able to use for the graphs:

  • XP earned in a time period (progress over time)
  • Levels over time
  • XP earned by project
  • Audit ratio
  • Projects PASS and FAIL ratio
  • Piscine (JS/Go) stats
    • PASS and FAIL ratio
    • Attempts for each exercise

Any other information you desire to display is welcome and will be noted


Usage

To test your queries you can access the GraphQL IDE on https://DOMAIN/public/subjects/graphql/ or create your own GraphiQL Docs. This will give you a bigger picture of the tables, attributes and all the types of queries that you can do.

Here is the list of tables that you are allowed to query (it will be only provided the columns present on the tables):

  • User table:

    This table will have information about the user

    id login
    1 person1
    2 person2
    3 person3
  • Transactions table:

    This table will give you access to XP and audits ratio

    id type amount objectId userId
    1 xp 234 42 1
    2 xp 1700 2 2
    3 xp 175 64 3
  • Progress_view table:

    id userId objectId grade
    1 1 3001 1
    2 2 198 0
    3 3 177 1
  • Results table:

    Both progress and result table will give you the student progression

    id objectId userId grade progressId type
    1 3 1 0 58
    2 23 1 0 58
    3 41 6 1 58
  • Object table:

    This table will give you information about all objects (exercises/projects)

    id name type attrs childrenAttrs
    1 0 exercise {"language": "dom", ... {}
    2 0 project {"language": "go", ... {}
    3 1 exercise {"language": "js", ... {}

Examples:

Lets take for instance the table user and try to query it:

{
  query {
      user {
          id
      }
  }
}

This simple query will return an array with the ids of the users. Imagine if you wanted the login,
you could just add this attribute to the query, example:

{
  query {
      user {
          id
          login
      }
  }
}

You can try to curl the API endpoint to see the result given by the server:

  • curl "https://[[DOMANIN]]/api/graphql-engine/v1/graphql" --data '{"query":"{user{id login}}"}'

Here is another example of a query using the table user:

{
  query {
    user(where: { id: { _eq: 6 }}) {
      id
      login
    }
  }
}

Note that for this query is required the introduction of variables (arguments)
so it will return just one user, the user that as the id equal to 6.

You can see the result using curl:

  • curl "https://[[DOMANIN]]/api/graphql-engine/v1/graphql" --data '{"query":"{user(where:{id:{_eq:6}}){id login}}"}'

In graphQL the usage of arguments can be specified in the schema of the API. Like said above you can visit the docs for the graphQL endpoint you are going to use, https://DOMAIN/public/subjects/grapqhl

Example using the nesting, using the result and user table :

{
  result {
    id
    user {
      id
      login
    }
  }
}

For this example we ask for the results id and users that are associated to the result, requesting the users names and ids.

This project will help you learn about: