Skip to content

Latest commit

 

History

History
178 lines (132 loc) · 3.46 KB

README.md

File metadata and controls

178 lines (132 loc) · 3.46 KB

Back a friend

Build Status Contributions Welcome Go Report Card codecov

Back a friend service: used backer package/library

Installation

Build and run

make run

Or pull from docker registry and run

docker-compose up -d

Known restrictions

  1. A several verifications of input attributes skipped due to complicating the task
  2. The project is used simplest JSON response without additional parameters like request attributes, totals and durations
  3. The players and the tournaments could not be deleted
  4. The points/money are not in separate transactional entity. This feature is skipped due to complicating the task.
  5. The database handlers are not asynchronous. It should be in high load systems.
  6. The package context is skipped due to complicating the task.

Endpoints description

Players endpoints

Funds (add to balance) player with 300 points. If no player exist should create new player with given amount of points

PUT /api/v1alpha/players/:id/fund
{
    "points": 300
}

Takes 300 points from player account

PUT /api/v1alpha/players/:id/take
{
    "points": 300
}

Player balance

GET /api/v1alpha/players/:id
{
    "player": "p1",
    "balance": 456.00
}

Tournaments endpoints

Announce tournament specifying the entry deposit

POST /api/v1alpha/tournaments/:id/announce
{
    "deposit": 1000
}

Join player into a tournament and is he backed by a set of backers

PUT /api/v1alpha/tournaments/:id/join
{
    "player": "p1",
    "backers": ["p2", "p3"]
}

Result tournament winners and prizes

POST /api/v1alpha/tournaments/:id
{
    "winners": [
        {
            "player": "p1",
            "prize": 2000.00
        }
    ]
}

Get results of tournament winners and prizes

GET /api/v1alpha/tournaments/:id
{
    "tournament": 1,
    "bidders": [
        {
            "player": "p1",
            "winner": true,
            "prize": 2000.00,
            "backers": ["b1", "b2"]
        },
        {
            "player": "p2",
            "winner": false,
            "prize": 0.00,
            "backers": []
        }
    ]
}

Engine endpoints

Reset the engine (database)

PUT /api/v1alpha/engine/reset

Service endpoints

Service info and current statuses

GET /info
{
    "version": "v0.1.0",
    "uptime": "1d 3h"
}

Service health

GET /healthz

Service readiness

GET /readyz

Versioning automation

Using a special script to increase the release version

./bumper.sh
Current version v0.1.0.
Please enter new version [v0.1.1]:

Contributing to the project

See the contribution guidelines for information on how to participate in the project by submitting pull requests or issues.

Versioned changes

All changes in the project located in changelog

License

MIT Public License