Nest Event Aggregator
A service that aggregates Nest cam activity and provides a GraphQL interface to query this data.

Configuration
Environment Variables
See .env.example for application configurations.
Docker Compose
Used to install dependent application services, like a Postgres database. See: https://docs.docker.com/compose/install/
Development
In development, environment variables will be picked up automatically from .env:
cp .env.example .env
Do it all with make
By default, this runs:
go fmt
go vet
golint
go test
go build
See Makefile for more targets.
Test
In another terminal, run:
docker-compose up
Then:
make test
Build
make build
Run
./nest-event-aggregator
Query
allEvents
curl -g 'http://localhost:8080/graphql?query={allEvents{id,has_sound,has_motion}}'
{
"data":{
"allEvents":[
{
"has_motion":true,
"has_sound":false,
"id":1
},
{
"has_motion":true,
"has_sound":false,
"id":2
},
{
"has_motion":false,
"has_sound":true,
"id":3
}
]
}
}
eventById
curl -g 'http://localhost:8080/graphql?query={eventById(id:4){start_time,end_time}}'
{
"data":{
"eventById":{
"start_time":"2017-12-28T20:37:14Z",
"end_time":"2017-12-28T20:37:27.152Z"
}
}
}
eventsBetween
curl -g 'http://localhost:8080/graphql?query={eventsBetween(start:"2017-12-28",end:"2017-12-30"){id}}'
{
"data":{
"eventsBetween":[
{
"id":1
},
{
"id":2
},
{
"id":3
},
{
"id":4
}
]
}
}
Contributing
Have a feature you want to see in this project? Open an issue with a clear description of what you are looking for. Fork the project, write tests and code, submit a pull request, and have it peer reviewed.
See a bug? Open an issue with a clear description of the bug, prefereably with a test that reproduces it. If you have a fix, do the same as above.
License
MIT license