git clone https://github.com/ChRomain/rubyTraining.git rubyTraining
cd rubyTraining
rails serverOpen a browser and go in port 3000.
- /articles: List all articles.
- /articles/new: Create article form.
- /articles/:id: Query a specific article.
- /articles/:id/edit: Update a specific article.
- /articles/:id/delete: Remove specific article.
Some routes endpoints for author also available.
Due to time limitation test coverage is low. Just nominal case for Article geter.
- Check title getter
- Check body getter
- Check author getter
- Check published_at getter
TODO/Improvement:
- Generate allure report
- Add other test about corner case, exist or not, corrupted db, load testing with multiple // call...
Once server is started open a browser and go in playground 3000/graphiql
TODO/Improvement
- Block schema documentation for unauthenticated user - for secu purpose
- Add pagination for query all items
- Add some input validation
- Add some server side batching
- Take ruby naming convention (not yet known)
- Check object imbrication - for now ok
- Check for schema introspection blocking
- Block auto completion
- Tke care of alias attack ....
You will have to be authenticated in order to play with some mutation/query. Steps:
- Execute logIn query:
mutation {
signUp (
input: {
email: "email@email.com"
password: "pwd"
role: admin
}
) { email role }
}
- LogIn with created user
mutation {
logIn(
input: {
email: "email@email.com"
password: "pwd"
}
) {
token
}
}
If user exist a bearer will be prompt in output. Copy it and for next query/mutation add it in Headers section as follow: { "Authorization": "Bearer PREVIOUS_TOKEN" }
Query all articles
query {
articles {
id
title
body
author { name email }
publishedAt
}
}
Query all articles written by a specific author
query {
articlesByAuthor (authorId: "{{authorId}}") {
body
id
title
}
}
Query a specific article
query {
article(id: "{{articleId}}") {
id
title
body
author { name email }
publishedAt
}
}
For now no input validation
Create a new article - Author must exist and be valid
mutation {
createArticle (
input: {
title: "Article test",
body: "Body test",
authorId: "{{authorId}}",
published_at: "2999-01-01T01:01:01Z"
}
) {
title
}
}
Update a specific article - Article id must exist and be valid
mutation {
updateArticle (
input: {
id: "{{articleId}}",
title: "New name",
body: "New body"
}
) {
title
}
}
Delete a specific article by his id - Article id must exist and be valid
mutation {
deleteArticle (
input: {
id: "{{articleId}}"
}
)
}
None
A rake script is present under lib/tasks/. Aims of this script is to be able to register authors or articles throught csv file. Those files must be placed under lib/assets folder.
If the script fail to register one author or one article it will continue to loop over the csv and print a report with number of error at the end.
sudo bundle exec rake import:allTODO/Improvement:
- Take csv form external source.
- Validate csv file: content, size for example.
- Print a pretty report at the end to indicate which author/article encountered issue.
- Ruby on Rails fundamental concepts
- The ails Command Line
- Ruby on Rails Projects: Introduction for Beginners
- Ruby on Rails - Introduction
- Ruby on Rails Tutorial for Beginners with Project & Example
- Using GraphQL with Rails 7: Building Efficient APIs
- Using GraphQL with Ruby on Rails
- Doc Ruby
- RailsGuides
- Set of tuto video on ruby on rails project
- Tutorial Ruby on Rails pour débutants avec projet et exemple
- Tester les applications Rails
- RSpec - Basic syntax
- Rake tutorial
- Ruby Rake Tutorial
- Rails Authentication with BCrypt & JWT, made simple and clear
- A lot of stack overflow