A dice rolling system, implemented on RubyOnRails using Graphql
- clone the repo
- build and create the db
docker-compose build
docker-compose run --rm web rails db:create
docker-compose run --rm web rails db:migrate
- start the server
# to run
docker-compose up
# to stop
docker-compose down
- Test on GraphiQL
go to http://localhost:3000/graphiql to get to the playground web view
docker-compose run --rm web rails test
# Roll '2d6+1d12' formula with an advantage
mutation Dices {
roll(input: { dices: "2de+1d12", advantage: advantage }) {
total
dices {
nodes {
dice
value
isAdvantage
}
}
}
}
# query the rolls
query Rolls {
rolls(first: 10) {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
total
dices {
totalCount
nodes {
value
dice
isAdvantage
}
}
}
}
}
}
# query a roll by ID
query Roll {
roll(id: 32) {
id
total
dices {
nodes {
value
dice
}
}
}
}