Skip to content

ilyadash/test_wallet_api

Repository files navigation

Wallet API


Русский

Эндпоинты

  • GET /api/v1/wallets/{wallet_uuid} — получить баланс кошелька
  • POST /api/v1/wallets/{wallet_uuid}/operation — пополнить или снять средства

Быстрый старт

docker compose up --build

Документация Swagger: http://localhost:8000/docs

Порт можно изменить через переменную окружения API_PORT (по умолчанию: 8000).

Запуск тестов

С хост-машины:

docker compose up -d
TEST_DB_HOST=localhost .venv/bin/pytest -v

Внутри Docker-контейнера:

docker compose exec api sh -c "uv sync --frozen --extra dev && pytest -v"

Переменные окружения

Смотри файл .env.example, где приведены доступные переменные.

Переменная По умолчанию Описание
POSTGRES_USER wallet_user Пользователь PostgreSQL
POSTGRES_PASSWORD wallet_pass Пароль PostgreSQL
POSTGRES_DB wallet_db Имя базы данных PostgreSQL
POSTGRES_HOST db Хост PostgreSQL
POSTGRES_PORT 5432 Порт PostgreSQL
API_PORT 8000 Внешний порт API-сервера

English

Endpoints

  • GET /api/v1/wallets/{wallet_uuid} — get wallet balance
  • POST /api/v1/wallets/{wallet_uuid}/operation — deposit or withdraw funds

Quick Start

docker compose up --build

Swagger docs: http://localhost:8000/docs

The port can be changed via the API_PORT environment variable (default: 8000).

Running Tests

From the host machine:

docker compose up -d
TEST_DB_HOST=localhost .venv/bin/pytest -v

Inside the Docker container:

docker compose exec api sh -c "uv sync --frozen --extra dev && pytest -v"

Environment Variables

See .env.example for the required variables.

Variable Default Description
POSTGRES_USER wallet_user PostgreSQL user
POSTGRES_PASSWORD wallet_pass PostgreSQL password
POSTGRES_DB wallet_db PostgreSQL database name
POSTGRES_HOST db PostgreSQL host
POSTGRES_PORT 5432 PostgreSQL port
API_PORT 8000 External port for the API server

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors