Files
bamort/backend/bmrt/transfer
Bardioc26 042a1d4773 Learncost frontend (#42)
* introduced central package  registry by package init function
* dynamic registration of routes, model, migrations and initializers.
* setting a docker compose project name to prevent shutdown of other containers with the same (composer)name
* ai documentation
* app template
* Create tests for ALL API entpoints in ALL packages Based on current data. Ensure that all API endpoints used in frontend are tested. These tests are crucial for the next refactoring tasks.
* adopting agent instructions for a more consistent coding style
* added desired module layout and debugging information
* Fix All Failing tests All failing tests are fixed now that makes the refactoring more easy since all tests must pass
* restored routes for maintenance
* added common translations
* added new tests for API Endpoint
* Merge branch 'separate_business_logic'
* added lern and skill improvement cost editing
* Set Docker image tag when building to prevent rebuild when nothing has changed
* add and remove PP for Weaponskill fixed
* add and remove PP for same named skills fixed
* add new task
2026-05-01 18:15:31 +02:00
..
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00
2026-05-01 18:15:31 +02:00

Transfer Package

The transfer package handles exporting and importing of characters and complete database content.

Features

Character Export/Import

  • Export single characters with all related data (skills, spells, equipment, etc.)
  • Import characters from JSON with automatic GSMaster data reconciliation
  • Download characters as JSON files

Database Export/Import

  • Export complete database to JSON file
  • Import complete database from JSON file
  • All database tables included (users, characters, skills, equipment, learning data, etc.)
  • Stored in ./backend/export_temp directory

API Endpoints

Character Operations

  • GET /api/transfer/export/:id - Export character as JSON (API response)
  • GET /api/transfer/download/:id - Download character as JSON file
  • POST /api/transfer/import - Import character from JSON

Database Operations

  • POST /api/transfer/database/export - Export complete database
  • POST /api/transfer/database/import - Import complete database

Usage Examples

Export Database

curl -X POST http://localhost:8180/api/transfer/database/export \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "message": "Database exported successfully",
  "filename": "database_export_20260101_120000.json",
  "filepath": "./backend/export_temp/database_export_20260101_120000.json",
  "record_count": 1234,
  "timestamp": "2026-01-01T12:00:00Z"
}

Import Database

curl -X POST http://localhost:8180/api/transfer/database/import \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filepath": "./backend/export_temp/database_export_20260101_120000.json"
  }'

Response:

{
  "message": "Database imported successfully",
  "record_count": 1234,
  "timestamp": "2026-01-01T12:00:01Z"
}

Technical Details

Database Export Format

The export includes all tables:

  • Users
  • Characters (with all relations: Eigenschaften, Lps, Aps, etc.)
  • Skills (SkFertigkeiten, SkWaffenfertigkeiten, SkZauber)
  • Equipment (EqAusruestungen, EqWaffen, EqContainers)
  • GSMaster data (Skills, WeaponSkills, Spells, Equipment, Weapons, etc.)
  • Learning data (Sources, CharacterClasses, SkillCategories, etc.)
  • Audit log entries

Import Behavior

  • Uses Save() for upsert logic (updates existing records, creates new ones)
  • Maintains referential integrity
  • Wrapped in transaction (all-or-nothing)

Testing

All functionality is fully tested with TDD approach:

go test -v ./transfer/