Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/defint/social-tournament
https://github.com/defint/social-tournament
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/defint/social-tournament
- Owner: defint
- Created: 2017-06-27T18:17:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-13T15:49:10.000Z (over 7 years ago)
- Last Synced: 2024-10-27T04:47:32.138Z (2 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Social tournament service
## Dependencies
* NodeJS
* Express
* body-parser
* Redis
* redis-lock## Setup
In terminal:
```
git clone https://github.com/defint/social-tournament
cd social-tournament
npm i
docker-compose up
```## Acceptance test
### Integer
* http://localhost:3000/reset
* http://localhost:3000/fund?playerId=P1&points=300
* http://localhost:3000/fund?playerId=P2&points=300
* http://localhost:3000/fund?playerId=P3&points=300
* http://localhost:3000/fund?playerId=P4&points=500
* http://localhost:3000/fund?playerId=P5&points=1000
* http://localhost:3000/announceTournament?tournamentId=1&deposit=1000
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P5
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P1&backerId=P2&backerId=P3&backerId=P4
* curl -H "Content-Type: application/json" -X POST -d '{"tournamentId": "1", "winners": [{"playerId": "P1", "prize": 2000}]}' http://localhost:3000/resultTourment
* http://localhost:3000/balance?playerId=P1
* http://localhost:3000/balance?playerId=P2
* http://localhost:3000/balance?playerId=P3
* http://localhost:3000/balance?playerId=P4
* http://localhost:3000/balance?playerId=P5### Float
* http://localhost:3000/reset
* http://localhost:3000/fund?playerId=P1&points=100
* http://localhost:3000/fund?playerId=P2&points=110
* http://localhost:3000/announceTournament?tournamentId=1&deposit=119
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P1&backerId=P2
* curl -H "Content-Type: application/json" -X POST -d '{"tournamentId": "1", "winners": [{"playerId": "P1", "prize": 119}]}' http://localhost:3000/resultTourment
* http://localhost:3000/balance?playerId=P1
* http://localhost:3000/balance?playerId=P2### Multiple winners
* http://localhost:3000/reset
* http://localhost:3000/fund?playerId=P1&points=100
* http://localhost:3000/fund?playerId=P2&points=200
* http://localhost:3000/fund?playerId=P3&points=300
* http://localhost:3000/fund?playerId=P4&points=400
* http://localhost:3000/fund?playerId=P5&points=500
* http://localhost:3000/announceTournament?tournamentId=1&deposit=250
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P5
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P4
* http://localhost:3000/joinTournament?tournamentId=1&playerId=P1&backerId=P2&backerId=P3
* curl -H "Content-Type: application/json" -X POST -d '{"tournamentId": "1", "winners": [{"playerId": "P1", "prize": 350},{"playerId": "P4", "prize": 350}]}' http://localhost:3000/resultTourment
* http://localhost:3000/balance?playerId=P1
* http://localhost:3000/balance?playerId=P2
* http://localhost:3000/balance?playerId=P3
* http://localhost:3000/balance?playerId=P4
* http://localhost:3000/balance?playerId=P5