This is a Proof of concept project that applies some concepts and technologies like Elixir/Phoenix, Schema Multi-Tenancy and GraphQL
It has some dependencies:
- Phoenix: The web framework
- Ecto/Postgrex: A database wrapper and the elixir client to Postgres
- Triplex: The library used to manage schemas
- Absinthe: An GraphQL implementation for elixir
- GenRMQ: A behaviour based library that handles the RabbitMQ connection
- Install Elixir
- Run Migrations
- Run server (mix phx.server)
or
docker-compose up
mix ecto.create
mix ecto.migrate
mix run priv/repo/seeds.exs
mix run priv/repo/appointment_seeds.exs
By running this project, the GraphQL endpoint will be available on http://localhost:4000/api
To use this interface, you have to add the User Reference id to the Authorization Header
Authorization: Bearer <user-reference-id>
{
appointmentGraph(filter: {startsAt: "2018-07-10T22:00:00.000Z",
endsAt: "2018-07-20T22:00:00.000Z"}, groupBy: HOUR) {
date
value
}
}
{
appointmentReport(filter: {startsAt: "2018-07-10T22:00:00.000Z",
endsAt: "2018-07-20T22:00:00.000Z"}) {
total
noShow
created
confirmed
}
}
I've tested this stack locally using wrk. There are some scripts to test it inside './scripts'.
wrk -t10 -c50 -d30s http://localhost:4000/api -s ./scripts/graph.lua