8000 GitHub - neoff/veikkaus: Demo repository for technical task · GitHub
[go: up one dir, main page]

Skip to content
neoffPublic

About

Demo repository for technical task

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Getting Started

It is test technical task for the company Veikkaus Veikkaus is a reactive Spring Boot microservice for managing players, their wallets, and game events. It is built using reactive programming principles with Project Reactor, R2DBC, and an PostgreSQL-compatible database.

TL;DR

  • DockerHub image: varg/veikkaus
  • Application work on port 8080 by default
docker run -p 8080:8080 varg/veikkaus

or docker compose

docker-compose up .

Env variables

  • DB_NODES : Database nodes (default: localhost:5432)
  • DB_NAME : Database name (default:veikkaus)
  • DB_USER : Database user (default: postgres)
  • DB_PASSWORD : Database password (default: postgres)
  • DB_MASTER_NODE : Database master node (for liquibase migration, default: localhost:5432)
  • DB_FAILOVER : Database failover (for multihost, ex: r2dbc:postgresql:failover://)

Features

  • Create and manage player accounts
  • Charge or credit player balances based on game events
  • Prevent duplicate events and duplicate players

Tech Stack

  • Java 21+
  • Maven 3.9.5
  • PostgreSQL 14+

API

  • for POST request used Basic Auth with username user and password password
  • The Swagger UI page will then be available at the following url: http://server:port/swagger-ui.html and the OpenAPI description will be available at the following url for json format: http://server:port/v3/api-docs
    • server: The server name or IP
    • port: The server port
    • context-path: The context path of the application

Request examples:

Player creation
curl --location 'http://127.0.0.1:8081/player' \
--header 'Content-Type: application/json' \
--data '{
  "name": "Evgenii"
}'

Builds

Build and run

./mvnw spring-boot:run

or

./mvnw clean package
java -jar target/veikkaus-0.0.1-SNAPSHOT.jar
Build with docke 6AF4 r
docker build -t veikkaus-app .
docker run -p 8080:8080 veikkaus-app

Testing

application-test.yaml is used for integration and contract tests.

Ensure both Liquibase and R2DBC point to the same in-memory database:

spring:
  r2dbc:
    url: r2dbc:h2:mem://localhost/testdb;DB_CLOSE_DELAY=-1;MODE=PostgreSQL
  liquibase:
    url: jdbc:h2:mem://localhost/testdb;DB_CLOSE_DELAY=-1;MODE=PostgreSQL

Troubleshooting

Liquibase tables not found during test: Ensure R2DBC and JDBC share the same memory database (localhost/testdb). Contracts not generating: Ensure spring-cloud-contract-maven-plugin has correct baseClassForTests configured.

Reference Documentation

For further reference, please consider the following sections:

About

Demo repository for technical task

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0