Pull Proclamations & Categories from API and store them in the database

This commit is contained in:
NeilClack
2026-03-23 17:35:52 -05:00
parent 17c088cc2f
commit 8d23841391
8 changed files with 161 additions and 54 deletions
+7 -7
View File
@@ -20,6 +20,7 @@ import (
"rhemawavetech.com/rhemawave/internal/mixer"
"rhemawavetech.com/rhemawave/internal/page"
"rhemawavetech.com/rhemawave/internal/shaderManager"
"rhemawavetech.com/rhemawave/internal/sync"
)
const (
@@ -27,9 +28,7 @@ const (
volumeStepSize = 16
openGLMajorVersion = 3
openGLMinorVersion = 3
apiURL = "http://localhost:8000"
apiPath = "/api/v1/licenseKey/validate"
audioFileURL = "https://files.neilclack.com/audio.wav"
apiURL = "http://localhost:5173/api/v1"
)
type Application struct {
@@ -56,7 +55,6 @@ func Run() {
var result *gorm.DB
logger.Info("Starting Application")
logger.Info("Finding $HOME")
homeDir, err = os.UserHomeDir()
if err != nil {
@@ -64,7 +62,6 @@ func Run() {
return
}
logger.Info("Constructing DataDir Path")
dataDir = filepath.Join(homeDir, ".local", "share", "rhemawave")
if err := os.MkdirAll(dataDir, 0755); err != nil {
logger.Error("unable to create data directory %s %v", dataDir, err)
@@ -82,8 +79,6 @@ func Run() {
logger.AddFile(filepath.Join(dataDir, "log.txt"))
logger.Info("Connecting to database")
DB, err = db.Connect(filepath.Join(dataDir, "database.sqlite"))
if err != nil {
logger.Error("application failed to connect to the database: %v", err)
@@ -141,6 +136,11 @@ func Run() {
H: h,
RefreshConfig: app.refreshCache,
})
// Sync the proclamations from the API to the Database
sync.SyncProclamations(apiURL, DB)
sync.SyncCategories(apiURL, DB)
app.runEventLoop()
}