Files
teamwallet/myteamwallet_backend
Bastian Wagner 1058d641e7 fix(teams): anchor balanceHistory to team.balance instead of forward-summing
Manual verification against real data (Task 3) found balanceHistory drifted
from team.balance for real teams, since team.balance carries historical
adjustments (e.g. from the removed legacy backend) that don't trace back to
the current payment/credit/expense rows. Forward-summing those rows from
zero could never be trusted to tie out.

Rewrite balanceHistory to anchor on team.balance (the authoritative current
value) and walk the movements backward, newest to oldest, undoing each one
to reconstruct earlier month-end balances. This guarantees the most recent
point equals team.balance by construction, and is mathematically identical
to the old forward sum for teams whose movements fully explain their
balance. monthlyFlow/topOutstanding are unaffected and left as-is.

Updated teams.service.spec.ts to use a fixture where team.balance
intentionally does not equal the sum of its own movements, so the tests
actually exercise the drift-handling behavior instead of a case where
forward-sum and backward-anchor happen to coincide.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 21:02:32 +02:00
..
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:20:16 +02:00
2026-08-01 13:17:26 +02:00
2026-08-01 13:17:26 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00
2026-07-31 21:02:47 +02:00

PROD System

Datenbank auf Server: teamwallet

NestJS REST API boilerplate 🇺🇦

ssh -L 3306:127.0.0.1:3306 bastian@h2979752.stratoserver.net

Description

Seeden: npm run seed:run

Table of Contents

Features

  • Database (typeorm).
  • Seeding.
  • Config Service (@nestjs/config).
  • Mailing (nodemailer, @nestjs-modules/mailer).
  • Sign in and sign up via email.
  • Social sign in (Apple, Facebook, Google, Twitter).
  • Admin and User roles.
  • File uploads. Support local and Amazon S3 drivers.
  • Swagger.
  • E2E and units tests.
  • Docker.
  • CI (Github Actions).

Quick run

git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env
docker compose up -d

For check status run

docker compose logs

Comfortable development

git clone --depth 1 https://github.com/brocoders/nestjs-boilerplate.git my-app
cd my-app/
cp env-example .env

Change DATABASE_HOST=postgres to DATABASE_HOST=localhost

Change MAIL_HOST=maildev to MAIL_HOST=localhost

Run additional container:

docker compose up -d postgres adminer maildev redis
npm install

npm run migration:run

npm run seed:run

npm run start:dev

Automatic update of dependencies

If you want to automatically update dependencies, you can connect Renovate for your project.

Database utils

Generate migration

npm run migration:generate -- src/database/migrations/CreateNameTable 

Run migration

npm run migration:run

Revert migration

npm run migration:revert

Drop all tables in database

npm run schema:drop

Run seed

npm run seed:run

Tests

# unit tests
npm run test

# e2e tests
npm run test:e2e

Tests in Docker

docker compose -f docker-compose.ci.yaml --env-file env-example -p ci up --build --exit-code-from api && docker compose -p ci rm -svf

Test benchmarking

docker run --rm jordi/ab -n 100 -c 100 -T application/json -H "Authorization: Bearer USER_TOKEN" -v 2 http://<server_ip>:3000/api/v1/users