Tiny Insurer App is a learning process in messaging (with RabbitMQ) and graphql topics.
The app simulates an Insurer Company that receive Insured and Vehicle informations and emmit an insured policy to the client.
This is a two part app that needs to run side-by-side. The second-parte is here: Tiny Insurer App - Rest API.
- Docker
- Ruby 3.3.0
- Rails 7.1.3.2
- Rspec
- Bunny
- pry-byebug
- RabbitMQ
- GraphQL
- Docker
- To see this application in action, up both parts with one simple
docker-compose up
. - Access the
localhost:3000/graphiql
or use your favorite API platform like Postman and Insomnia. - Go to the Endpoints and Payloads
Get policy by ID
{
policy(id: 1) {
id
insuredAt
insuredUntil
insured {
id
name
cpf
}
vehicle {
id
plate
brand
model
year
}
}
}
Get all Policies
{
policies {
id
insuredAt
insuredUntil
insured {
id
name
cpf
}
vehicle {
id
plate
brand
model
year
}
}
}
Create new policy
mutation createPolicyMutation(
$insuredAt: String!
$insuredUntil: String!
$insuredName: String!
$insuredCpf: String!
$vehiclePlate: String!
$vehicleBrand: String!
$vehicleModel: String!
$vehicleYear: Int!
) {
createPolicy(
input: {
policy: {
insuredAt: $insuredAt
insuredUntil: $insuredUntil
insured: { name: $insuredName, cpf: $insuredCpf }
vehicle: {
plate: $vehiclePlate
brand: $vehicleBrand
model: $vehicleModel
year: $vehicleYear
}
}
}
){ success }
}