Skip to content

Latest commit

 

History

History

profile

Profile Service

The Profile Service provides a REST API to interact with Cloud Spanner to manage Player Profiles. The service runs on GKE Autopilot.

API

Endpoint Input Return Description
GET /players/:player_id: None
{
"player_google_id": "[string]",
"player_name": "[string]",
"profile_image": "[string]",
"region": "[string]"
}
Retrieve information about the player
GET /players/:player_id:/stats None
{
"player_google_id": "[string]",
"stats": "[json]",
"skill_level": [int64],
"tier": "[string]" # currently unused
}
Retrieve stats and skill info about the player
POST /players
{
"player_google_id": "[string]",
"player_name": "[string]",
"profile_image": "default", # Currently unused
"region": "[amer,eur,apac]"
}
                    "[player_google_id]"
                
Create a new player
PUT /players
{
"player_google_id": "[string]",
"player_name": "[string]",
"profile_image": "default", # Currently unused
"region": "[amer,eur,apac]"
}
{
"player_google_id": "[string]",
"player_name": "[string]",
"profile_image": "[string]",
"region": "[string]"
}
Update player information
PUT /players/:player_id:/stats
{
"won": [true, false],
"score": [int64],
"kills": [int64],
"deaths": [int64]
}
{
"player_google_id": "[string]",
"stats": "[json]",
"skill_level": [int64],
"tier": "[string]" # currently unused
}
Update player stats

Prerequisites

Cloud Spanner must be set up using the infrastructure steps before this service will work.

Local testing requires Docker to be installed.

Schema management

This service uses the Liquibase Spanner extension to perform Cloud Spanner schema migrations.

Local deployment

This service provides a Makefile to build a binary as well as run various tests. These tests require Docker to work.

The following commands should be run from the ./services/profile directory. Build a local binary:

make build

NOTE: This build command does not build a docker container.

Build the docker container:

make build-docker

Run unit tests:

make test-unit

Run integration tests:

make test-integration

Cleanup binary and docker images:

make clean