Skip to content

iafoosball/matches-service

Repository files navigation

Matches Service

This service handles all data relevant for matches, this includes the goals, the player IDs, how many players per side, the goal speed and more. All endpoints are specific to a match and for the moment all endpoints can be used. In the future we plan to introduce a live match service, based on Websockets and upload information as batch opererations to this service.

On a side note, the service does not handle any personal data and when excluding the player IDs the data can be used for statistics without further considerations.

How to build and run this service

As a prerequiste you need to have docker and docker-compose installed. Installation guides can be found online.
The service is based on Golang and thus requires a working installation. Download the repo to your local machine.
go get github.com/iafoosball/matches-service
We use dep as our dependency management tool. To install it use
go get -u github.com/golang/dep/cmd/dep
which should put a binary in your go bin folder.
Next get the go-swagger library, which is used to produce a sevrer from a openAPI spec file.
go get github.com/go-swagger/go-swagger/cmd/swagger
From inside the matches-service folder, where the matches.yml file and all other configuration files are, ensure all dependencies and produce the server
../../../../bin/dep ensure -vendor-only
and for the server
go run ../../go-swagger/go-swagger/cmd/swagger/swagger.go generate server -f matches.yml -A matches
Finally, make the startMatches.sh file executable and execute it by using chmod +x startMatches.sh && ./startMatches.sh
This will start an the database (ArangoDB) and

Pagination API Usage

Filter

Get latest 5 games FOR doc IN matches Sort doc.startTime DESC Limit 0, 5 RETURN doc

Example how to retrieve the first five items of 2019-01-19. NOT WOKRING!!!

Input URL without escape:

http://iafoosball.me:9000/matches/
?filter=like(doc.startTime,'2019-01-19%')

Input URL with escape:

http://iafoosball.me:9000/matches/
?filter=like(doc.startTime,%272019-01-19%%27)

Output for ArangoDB:

FOR doc IN matches FILTER DATE_DAY(doc.startTime)==19 Filter DATE_MONTH(doc.startTime)==1 Filter DATE_YEAR(doc.startTime)==2019
Sort doc.startTime DESC Limit 0, 5 RETURN doc

Others

Produce a dependency map

https://golang.github.io/dep/docs/daily-dep.html#visualizing-dependencies

TODOS

Should we integrate godocs? Can be easily produced via godoc -http=:3333 -goroot /home/joe/go/src/github.com/iafoosball/matches-service/matches They don't provide any real value. Just leaving it here as food for thought.

Add central swagger ui serer and documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published