feat(go, ts): add system-region mapping and highlight functionality

This commit is contained in:
2025-08-10 22:26:02 +02:00
parent 2561cd7d30
commit 97178bc9a5
7 changed files with 103 additions and 38 deletions

22
app.go
View File

@@ -138,3 +138,25 @@ func (a *App) GetCharacterLocations() ([]CharacterLocation, error) {
defer cancel()
return a.ssi.GetCharacterLocations(ctx)
}
// SystemRegion holds system + region names from local DB
type SystemRegion struct {
System string `json:"system"`
Region string `json:"region"`
}
// ListSystemsWithRegions returns all solar system names and their regions from the local SQLite DB
func (a *App) ListSystemsWithRegions() ([]SystemRegion, error) {
if a.ssi == nil || a.ssi.db == nil {
return nil, errors.New("db not initialised")
}
var rows []SystemRegion
// mapSolarSystems has regionID; mapRegions has regionName
q := `SELECT s.solarSystemName AS system, r.regionName AS region
FROM mapSolarSystems s
JOIN mapRegions r ON r.regionID = s.regionID`
if err := a.ssi.db.Raw(q).Scan(&rows).Error; err != nil {
return nil, err
}
return rows, nil
}