mirror of https://github.com/01-edu/public.git
fix(graphql): fixing the readme and audit according to the new chages
This commit is contained in:
parent
6488a25241
commit
57ee55bba6
|
@ -12,7 +12,6 @@ Your profile must display three pieces of information which you may choose. For
|
|||
|
||||
- Basic user identification
|
||||
- XP amount
|
||||
- level
|
||||
- grades
|
||||
- audits
|
||||
- skills
|
||||
|
@ -23,15 +22,13 @@ Beside those sections it will have a mandatory section for the generation of sta
|
|||
|
||||
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.
|
||||
|
||||
The UI design is up to you. However, have in mind the principles of a [good UI](../good-practices/README.md).\
|
||||
The 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](https://developer.mozilla.org/en-US/docs/Web/SVG). You will have to do at least **two different statistic graphs** for the data given.
|
||||
The UI design is up to you. However, it must 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](https://developer.mozilla.org/en-US/docs/Web/SVG). You need to do at least **two different statistic graphs** for the data given. Bare in mind the principles of a [good UI](../good-practices/README.md).
|
||||
|
||||
Using SVG you can create several [types of graphs](https://www.tutorialspoint.com/svg/graph.htm) including interactive graphs and animated graph. It will be up to you to decide what type of graphs you are going to do.
|
||||
|
||||
Here are some possible combinations for the creation of 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
|
||||
|
@ -65,53 +62,53 @@ for example: [github-pages](https://pages.github.com/), [netlify](https://www.ne
|
|||
|
||||
Here are a selection of interesting tables and columns which are exposed via GraphQL:
|
||||
|
||||
- **User table**:
|
||||
- **user** table:
|
||||
|
||||
This table will have information about the user
|
||||
This table will have information about the user.
|
||||
|
||||
| id | login |
|
||||
| --- | ------: |
|
||||
| 1 | person1 |
|
||||
| 2 | person2 |
|
||||
| 3 | person3 |
|
||||
|
||||
- **Transactions table**:
|
||||
- **transaction** table:
|
||||
|
||||
This table will give you access to XP and audits ratio
|
||||
This table will give you access to `XP` and through `user` table you can get to the `audits ratio` as well.
|
||||
|
||||
| id | type | amount | objectId | userId | createdAt | path |
|
||||
| --- | :--: | -----: | -------: | -----: | -------------------------------: | ---------------------: |
|
||||
| 1 | xp | 234 | 42 | 1 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 2 | xp | 1700 | 2 | 2 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 3 | xp | 175 | 64 | 3 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 2 | xp | 1700 | 2 | 1 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 3 | xp | 175 | 64 | 1 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
|
||||
- **Progress table**:
|
||||
- **progress** table:
|
||||
|
||||
| id | userId | objectId | grade | createdAt | updatedAt | path |
|
||||
| --- | :----: | -------: | ----: | -------------------------------: | -------------------------------: | --------------------------: |
|
||||
| 1 | 1 | 3001 | 1 | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/piscine-go/quest-01 |
|
||||
| 2 | 2 | 198 | 0 | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/piscine-go/quest-01 |
|
||||
| 3 | 3 | 177 | 1 | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/piscine-go/quest-01 |
|
||||
| 2 | 1 | 198 | 0 | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/piscine-go/quest-01 |
|
||||
| 3 | 1 | 177 | 1 | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/piscine-go/quest-01 |
|
||||
|
||||
- **Results table**:
|
||||
- **result** table:
|
||||
|
||||
Both progress and result table will give you the student progression
|
||||
Both `progress` and `result` table will give you the student progression.
|
||||
|
||||
| id | objectId | userId | grade | progressId | type | createdAt | updatedAt | path |
|
||||
| --- | -------: | -----: | ----: | ---------: | ---: | -------------------------------: | -------------------------------: | ---------------------: |
|
||||
| 1 | 3 | 1 | 0 | 58 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 2 | 23 | 1 | 0 | 58 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 3 | 41 | 6 | 1 | 58 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| id | objectId | userId | grade | type | createdAt | updatedAt | path |
|
||||
| --- | -------: | -----: | ----: | ---: | -------------------------------: | -------------------------------: | ---------------------: |
|
||||
| 1 | 3 | 1 | 0 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 2 | 23 | 1 | 0 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
| 3 | 41 | 1 | 1 | | 2021-07-26T13:04:02.301092+00:00 | 2021-07-26T13:04:02.301092+00:00 | /madere/div-01/graphql |
|
||||
|
||||
- **Object table**:
|
||||
- **object** table:
|
||||
|
||||
This table will give you information about all objects (exercises/projects)
|
||||
This table will give you information about all objects (exercises/projects).
|
||||
|
||||
| id | name | type | childrenAttrs |
|
||||
| --- | ---: | -------: | ------------: |
|
||||
| 1 | 0 | exercise | `{}` |
|
||||
| 2 | 0 | project | `{}` |
|
||||
| 3 | 1 | exercise | `{}` |
|
||||
| id | name | type | attrs |
|
||||
| --- | ---: | -------: | ----: |
|
||||
| 1 | 0 | exercise | `{}` |
|
||||
| 2 | 0 | project | `{}` |
|
||||
| 3 | 1 | exercise | `{}` |
|
||||
|
||||
For more information about the tables and their columns you check out the [database-structure](http://public.01-edu.org/docs/db/database-structure) and [database-relations](http://public.01-edu.org/docs/db/db-relations).
|
||||
|
||||
Examples:
|
||||
|
||||
|
@ -119,67 +116,42 @@ Lets take for instance the table `user` and try to query it:
|
|||
|
||||
```js
|
||||
{
|
||||
query {
|
||||
user {
|
||||
id
|
||||
}
|
||||
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 like so:
|
||||
This simple query will return an array with the `id` of the authenticated user. If you wanted the `login`,
|
||||
you could just add the attribute to the query like so:
|
||||
|
||||
```js
|
||||
{
|
||||
query {
|
||||
user {
|
||||
id
|
||||
login
|
||||
}
|
||||
user {
|
||||
id
|
||||
login
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can use `curl` query they API:
|
||||
|
||||
```console
|
||||
curl --location 'https://((DOMAIN))/api/graphql-engine/v1/graphql' \
|
||||
--header 'Authorization: Bearer <JWT>' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"query":"{user {id login}}","variables":{}}'
|
||||
```
|
||||
|
||||
Here is another example of a query using the table `user`:
|
||||
|
||||
```js
|
||||
{
|
||||
query {
|
||||
user(where: { id: { _eq: 6 }}) {
|
||||
id
|
||||
login
|
||||
}
|
||||
object(where: { id: { _eq: 3323 }}) {
|
||||
name
|
||||
type
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Note** that for this query the introduction of variables (arguments) **is required**,
|
||||
so it will return just one user, the user that has the `id` equal to `6`.
|
||||
|
||||
You can see the result using `curl`:
|
||||
|
||||
```console
|
||||
curl --location 'https://content.01-edu.org/api/graphql-engine/v1/graphql' \
|
||||
--header 'Authorization: Bearer <JWT>' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"query":"{user(where:{id:{_eq:6}}){id login}}","variables":{}}'
|
||||
```
|
||||
> Note: that for this query the introduction of variables (arguments) is **required**, so it will return just one object with the `id` equal to `3323`.
|
||||
|
||||
In GraphQL, the usage of arguments are specified in the schema. You can see the available query parameters by introspecting the API.
|
||||
|
||||
> If you're logged in to the platform, you may access [GraphiQL](<https://((DOMAIN))/graphiql/>) to more easily explore the schema.
|
||||
|
||||
Example of nesting, using the result and user table :
|
||||
Example of nesting using the `result` and `user` table:
|
||||
|
||||
```js
|
||||
{
|
||||
|
@ -193,7 +165,7 @@ Example of nesting, using the result and user table :
|
|||
}
|
||||
```
|
||||
|
||||
For this example we ask for the results `id` and `user`s that are associated to the `result`, requesting the users `login`s and `id`s.
|
||||
For this example we ask for the results `id` and `user` that is associated to the `result`, requesting the user `login` and his `id`.
|
||||
|
||||
**You must use all the types of querying present above** (_normal_, _nested_ and using _arguments_), do not forget that you can use the types together or separately.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#### Functionals
|
||||
#### Functional
|
||||
|
||||
##### Try to log in with invalid credentials
|
||||
|
||||
|
@ -41,11 +41,3 @@
|
|||
###### +Did the student generated their own GraphiQL?
|
||||
|
||||
###### +Does the UI respect the [good practices](../../good-practices/README.md)?
|
||||
|
||||
###### +Do you think in general this project is well done?
|
||||
|
||||
#### Social
|
||||
|
||||
###### +Did you learn anything from this project?
|
||||
|
||||
###### +Would you recommend/nominate this program as an example for the rest of the school?
|
||||
|
|
Loading…
Reference in New Issue