Merge pull request #21 from Bardioc26/small_fixes_aside

Small fixes aside

Frontend Version: 0.1.30
Backend Version: 0.1.38
This commit is contained in:
Bardioc26
2026-01-25 22:02:59 +01:00
committed by GitHub
22 changed files with 124 additions and 73 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
This package is part of the Bamort monorepo and is licensed under the PolyForm Noncommercial License 1.0.0.
This package is part of the BaMoRT monorepo and is licensed under the PolyForm Noncommercial License 1.0.0.
See ../LICENSE
+2 -2
View File
@@ -224,7 +224,7 @@ func GetCharacterExperienceAndWealth(c *gin.Context) {
}
// Berechne Gesamtvermögen in Silbergroschen
// Annahme: 1 GS = 10 SS, 1 SS = 10 KS (typische Midgard Währung)
// Annahme: 1 GS = 10 SS, 1 SS = 10 KS (typische PRG Währung)
gs := character.Vermoegen.Goldstuecke
ss := character.Vermoegen.Silberstuecke
ks := character.Vermoegen.Kupferstuecke
@@ -1750,7 +1750,7 @@ func getSpellLECost(level int) int {
// Query the database for the LE cost for this level
err := database.DB.Where("level = ? AND game_system = ?", level, "midgard").First(&spellLECost).Error
if err != nil {
// If not found in database, fall back to standard Midgard costs
// If not found in database, fall back to standard RPG costs
spellLECosts := map[int]int{
1: 1,
2: 2,
+3 -3
View File
@@ -17,9 +17,9 @@ import (
"github.com/gin-gonic/gin"
)
// @title Bamort API
// @title BaMoRT API
// @version 1
// @description This is the API for Bamort
// @description This is the API for BaMoRT
// @host localhost:8180
// @BasePath /
// @schemes http
@@ -39,7 +39,7 @@ func main() {
logger.SetMinLogLevel(logger.INFO)
}
logger.Info("Bamort Server wird gestartet...")
logger.Info("BaMoRT Server wird gestartet...")
logger.Debug("Debug-Modus ist aktiviert")
logger.Info("Environment: %s", cfg.Environment)
logger.Info("testingDB Set: %s", cfg.DevTesting)
+1 -1
View File
@@ -1,7 +1,7 @@
package config
// Version is the application version
const Version = "0.1.37"
const Version = "0.1.38"
var (
// GitCommit will be set by build flags or detected at runtime
+22 -1
View File
@@ -11,9 +11,30 @@ func MigrateStructure(db ...*gorm.DB) error {
targetDB = DB
}
err := targetDB.AutoMigrate()
err := targetDB.AutoMigrate(
&SchemaVersion{},
&MigrationHistory{},
)
if err != nil {
return err
}
return nil
}
func MigrateDataIfNeeded(db *gorm.DB) error {
// Implement data migration logic here if needed
schemaVersion := SchemaVersion{}
err := db.First(&schemaVersion, "version = ?", "0.1.37").Error
if err != nil {
// No initial version found, assume no migration needed
schemaVersion.Version = "0.1.37"
schemaVersion.MigrationNumber = 1
schemaVersion.BackendVersion = "0.1.37"
schemaVersion.Description = "Initial schema version"
err = db.Create(&schemaVersion).Error
if err != nil {
return err
}
}
return nil
}
+36
View File
@@ -0,0 +1,36 @@
package database
// SchemaVersion represents the schema_version table
type SchemaVersion struct {
ID uint `gorm:"primaryKey;autoIncrement"`
Version string `gorm:"size:20;not null;index"`
MigrationNumber int `gorm:"not null;index"`
AppliedAt int64 `gorm:"autoCreateTime"`
BackendVersion string `gorm:"size:20;not null"`
Description string `gorm:"type:text"`
Checksum string `gorm:"size:64"`
}
// TableName sets the table name for SchemaVersion
func (SchemaVersion) TableName() string {
return "schema_version"
}
// MigrationHistory represents the migration_history table
type MigrationHistory struct {
ID uint `gorm:"primaryKey;autoIncrement"`
MigrationNumber int `gorm:"not null;uniqueIndex"`
Version string `gorm:"size:20;not null;index"`
Description string `gorm:"type:text;not null"`
AppliedAt int64 `gorm:"autoCreateTime"`
AppliedBy string `gorm:"size:100"`
ExecutionTimeMs int64
Success bool `gorm:"default:true"`
ErrorMessage string `gorm:"type:text"`
RollbackAvailable bool `gorm:"default:true"`
}
// TableName sets the table name for MigrationHistory
func (MigrationHistory) TableName() string {
return "migration_history"
}
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"strings"
)
// ExportCharToVTT converts a Bamort character to VTT JSON format
// ExportCharToVTT converts a BaMoRT character to VTT JSON format
func ExportCharToVTT(char *models.Char) (*CharacterImport, error) {
vtt := &CharacterImport{}
+23 -32
View File
@@ -63,9 +63,15 @@ func migrateAllStructures(db *gorm.DB) error {
func migrateDataIfNeeded(db *gorm.DB) error {
logger.Debug("Starte Datenmigration falls erforderlich...")
err := database.MigrateDataIfNeeded(db)
if err != nil {
logger.Error("Fehler beim Migrieren der Datenbankdaten: %s", err.Error())
return fmt.Errorf("failed to migrate database data: %w", err)
}
// Kopiere categorie nach learning_category für Spells, wenn learning_category leer ist
logger.Debug("Migriere Spell Learning Categories...")
err := migrateSpellLearningCategories(db)
err = migrateSpellLearningCategories(db)
if err != nil {
logger.Error("Fehler beim Migrieren der Spell Learning Categories: %s", err.Error())
return fmt.Errorf("failed to migrate spell learning categories: %w", err)
@@ -501,18 +507,7 @@ func getTestDataStatistics(db *gorm.DB) (map[string]int64, error) {
return stats, nil
}
func SetupCheck(c *gin.Context) {
logger.Info("Starte Setup-Check...")
db := database.ConnectDatabase()
if db == nil {
logger.Error("Fehler beim Verbinden mit der Datenbank für Setup-Check")
respondWithError(c, http.StatusInternalServerError, "Failed to connect to DataBase")
return
}
logger.Debug("Erfolgreich mit Datenbank für Setup-Check verbunden")
func setupCheck(c *gin.Context, db *gorm.DB) {
logger.Debug("Führe Strukturmigration durch...")
err := migrateAllStructures(db)
if err != nil {
@@ -531,6 +526,20 @@ func SetupCheck(c *gin.Context) {
logger.Info("Setup-Check erfolgreich abgeschlossen")
c.JSON(http.StatusOK, gin.H{"message": "Setup Check OK"})
}
func SetupCheck(c *gin.Context) {
logger.Info("Starte Setup-Check...")
db := database.ConnectDatabase()
if db == nil {
logger.Error("Fehler beim Verbinden mit der Datenbank für Setup-Check")
respondWithError(c, http.StatusInternalServerError, "Failed to connect to DataBase")
return
}
logger.Debug("Erfolgreich mit Datenbank für Setup-Check verbunden")
setupCheck(c, db)
}
func SetupCheckDev(c *gin.Context) {
@@ -545,25 +554,7 @@ func SetupCheckDev(c *gin.Context) {
database.DB = db
logger.Debug("Erfolgreich mit Datenbank für Setup-Check verbunden")
logger.Debug("Führe Strukturmigration durch...")
err := migrateAllStructures(db)
if err != nil {
logger.Error("Fehler bei der Strukturmigration: %s", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
logger.Debug("Führe Datenmigration durch...")
err = migrateDataIfNeeded(db)
if err != nil {
logger.Error("Fehler bei der Datenmigration: %s", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to migrate data: " + err.Error()})
return
}
logger.Info("Setup-Check erfolgreich abgeschlossen")
c.JSON(http.StatusOK, gin.H{"message": "Setup Check OK"})
setupCheck(c, db)
}
/*
+1 -1
View File
@@ -1,4 +1,4 @@
# Environment variables for Bamort development environment
# Environment variables for BaMoRT development environment
# API Configuration
# API_URL=http://localhost:8180
+1 -1
View File
@@ -6,7 +6,7 @@
BACKEND_URL="http://localhost:8180"
ENDPOINT="/api/maintenance/transfer-sqlite-to-mariadb"
echo "=== Bamort Data Transfer: SQLite to MariaDB ==="
echo "=== BaMoRT Data Transfer: SQLite to MariaDB ==="
echo ""
# Check if clear parameter is provided
+1 -1
View File
@@ -1,3 +1,3 @@
This package is part of the Bamort monorepo and is licensed under the PolyForm Noncommercial License 1.0.0.
This package is part of the BaMoRT monorepo and is licensed under the PolyForm Noncommercial License 1.0.0.
See ../LICENSE
+1 -1
View File
@@ -1,6 +1,6 @@
# Bamort Frontend
Vue 3 + Vite frontend for the Bamort monorepo.
Vue 3 + Vite frontend for the BaMoRT monorepo.
## Development
+1 -1
View File
@@ -1,6 +1,6 @@
# Frontend Version Management
## Current Version: 0.1.29
## Current Version: 0.1.30
The frontend version is managed independently from the backend.
+1 -1
View File
@@ -5,7 +5,7 @@
<!-- <link rel="icon" href="/favicon.ico">-->
<link rel="icon" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bamort</title>
<title>BaMoRT</title>
</head>
<body>
<div id="app"></div>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bamort-frontend",
"version": "0.1.29",
"version": "0.1.30",
"private": true,
"license": "SEE LICENSE IN LICENSE",
"type": "module",
+5 -5
View File
@@ -16,7 +16,7 @@
<option value="">{{ $t('export.pleaseSelectFormat') }}</option>
<option value="pdf">{{ $t('export.formatPDF') }}</option>
<option value="vtt">{{ $t('export.formatVTT') }}</option>
<option value="bamort">{{ $t('export.formatBamort') }}</option>
<option value="bamort">{{ $t('export.formatBaMoRT') }}</option>
</select>
</div>
<div v-if="selectedFormat === 'pdf'" class="form-group">
@@ -111,7 +111,7 @@ export default {
} else if (this.selectedFormat === 'vtt') {
await this.exportToVTT()
} else if (this.selectedFormat === 'bamort') {
await this.exportToBamort()
await this.exportToBaMoRT()
}
},
@@ -187,11 +187,11 @@ export default {
}
},
async exportToBamort() {
async exportToBaMoRT() {
this.isExporting = true
try {
// Get Bamort JSON data and trigger download
// Get BaMoRT JSON data and trigger download
const response = await API.get(`/api/transfer/download/${this.characterId}`, {
responseType: 'blob'
})
@@ -210,7 +210,7 @@ export default {
this.$emit('export-success')
this.closeDialog()
} catch (error) {
console.error('Failed to export Bamort format:', error)
console.error('Failed to export BaMoRT format:', error)
alert(this.$t('export.exportFailed') + ': ' + (error.response?.data?.error || error.message))
} finally {
this.isExporting = false
+2 -2
View File
@@ -88,7 +88,7 @@ export default {
},
landing:{
title:'BaMoRT - Charakterverwaltung für mein Lieblingsrollenspielsystem',
description:'Bamort ist ein Werkzeug zur Charakterverwaltung für Rollenspiele. Es bietet Funktionen zur Charaktererstellung, -entwicklung und -verwaltung mit Unterstützung für Fertigkeiten, Zauber, Ausrüstung und mehr. Viele Ausrüstungsteile, Fertikeiten und Zauber fehlen noch, da das Projekt noch in der Entwicklung ist.',
description:'BaMoRT ist ein Werkzeug zur Charakterverwaltung für Rollenspiele. Es bietet Funktionen zur Charaktererstellung, -entwicklung und -verwaltung mit Unterstützung für Fertigkeiten, Zauber, Ausrüstung und mehr. Viele Ausrüstungsteile, Fertikeiten und Zauber fehlen noch, da das Projekt noch in der Entwicklung ist.',
frontendVersion:'Frontend Version',
backendVersion:'Backend Version',
version:'Version',
@@ -656,7 +656,7 @@ export default {
},
faq4: {
question: 'Wie funktioniert die Charaktererstellung?',
answer: 'Die Charaktererstellung basiert auf dem Midgard-Regelsystem. Wählen Sie Volk, Geschlecht und Klasse und verteilen Sie dann Ihre Attributswerte. Das System berechnet automatisch alle abgeleiteten Werte.'
answer: 'Die Charaktererstellung basiert auf einem populären deutschen Rollenspiel-Regelsystem. Wählen Sie Volk, Geschlecht und Klasse und verteilen Sie dann Ihre Attributswerte. Das System berechnet automatisch alle abgeleiteten Werte.'
},
faq5: {
question: 'Werden meine Daten gespeichert?',
+2 -2
View File
@@ -87,7 +87,7 @@ export default {
},
landing:{
title:'BaMoRT - Character Management for Role-Playing Games',
description:'Bamort is a modern character management tool for role-playing games. It provides comprehensive features for character creation, development, and management with support for skills, spells, equipment, and more.',
description:'BaMoRT is a modern character management tool for role-playing games. It provides comprehensive features for character creation, development, and management with support for skills, spells, equipment, and more.',
frontendVersion:'Frontend Version',
backendVersion:'Backend Version',
version:'Version',
@@ -651,7 +651,7 @@ export default {
},
faq4: {
question: 'How does character creation work?',
answer: 'Character creation is based on the Midgard rule system. Choose race, gender, and class, then distribute your attribute values. The system automatically calculates all derived values.'
answer: 'Character creation is based on a popular German RPG rule system. Choose race, gender, and class, then distribute your attribute values. The system automatically calculates all derived values.'
},
faq5: {
question: 'Is my data saved?',
+16 -13
View File
@@ -1,22 +1,26 @@
import { createRouter, createWebHistory } from "vue-router";
import { isLoggedIn } from "../utils/auth"; // Import the helper function
import { isLoggedIn } from "../utils/auth";
import { useUserStore } from '../stores/userStore';
// Static imports for landing/auth pages (needed immediately)
import LandingView from "../views/LandingView.vue";
import LoginView from "../views/LoginView.vue";
import RegisterView from "../views/RegisterView.vue";
import ForgotPasswordView from "../views/ForgotPasswordView.vue";
import ResetPasswordView from "../views/ResetPasswordView.vue";
import DashboardView from "../views/DashboardView.vue";
import AusruestungView from "../views/AusruestungView.vue";
import MaintenanceView from "../views/MaintenanceView.vue";
import FileUploadPage from "../views/FileUploadPage.vue";
import UserProfileView from "../views/UserProfileView.vue";
import UserManagementView from "../views/UserManagementView.vue";
import SponsorsView from "../views/SponsorsView.vue";
import HelpView from "../views/HelpView.vue";
import SystemInfoView from "../views/SystemInfoView.vue";
import CharacterDetails from "@/components/CharacterDetails.vue";
import CharacterCreation from "@/components/CharacterCreation.vue";
// Lazy-loaded views (code-split into separate chunks)
const DashboardView = () => import("../views/DashboardView.vue");
const AusruestungView = () => import("../views/AusruestungView.vue");
const MaintenanceView = () => import("../views/MaintenanceView.vue");
const FileUploadPage = () => import("../views/FileUploadPage.vue");
const UserProfileView = () => import("../views/UserProfileView.vue");
const UserManagementView = () => import("../views/UserManagementView.vue");
const SponsorsView = () => import("../views/SponsorsView.vue");
const HelpView = () => import("../views/HelpView.vue");
const SystemInfoView = () => import("../views/SystemInfoView.vue");
const CharacterDetails = () => import("@/components/CharacterDetails.vue");
const CharacterCreation = () => import("@/components/CharacterCreation.vue");
@@ -55,7 +59,6 @@ router.beforeEach(async (to, from, next) => {
next({ name: "Login" });
} else if (to.meta.requiresAdmin) {
// Check if route requires admin role
const { useUserStore } = await import('../stores/userStore')
const userStore = useUserStore()
// Fetch user if not already loaded
+1 -1
View File
@@ -1,5 +1,5 @@
// Frontend version information
export const VERSION = '0.1.29'
export const VERSION = '0.1.30'
// Git commit will be injected at build time or detected from env
export const GIT_COMMIT = import.meta.env.VITE_GIT_COMMIT || 'unknown'
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="landing-page">
<div class="landing-content">
<div class="dragon-container">
<img src="/bamorty.png" alt="Bamort Dragon" class="dragon-image" />
<img src="/bamorty.png" alt="BaMoRT Dragon" class="dragon-image" />
</div>
<div class="info-container">
+1 -1
View File
@@ -1,4 +1,4 @@
# Environment variables for Bamort development environment
# Environment variables for BaMoRT development environment
# API Configuration
# API_URL=http://localhost:8180