A service that aggregates Nest cam activity and provides a GraphQL interface to query this data.
See .env.example
for application configurations.
Used to install dependent application services, like a Postgres database. See: https://docs.docker.com/compose/install/
In development, environment variables will be picked up automatically from .env
:
cp .env.example .env
By default, this runs:
go fmt
go vet
golint
go test
go build
See Makefile
for more targets.
In another terminal, run:
docker-compose up
Then:
make test
make build
./nest-event-aggregator
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
}
]
}
}
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"
}
}
}
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
}
]
}
}
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.