Proclamations change colors!

This commit is contained in:
NeilClack
2026-05-31 12:08:19 -05:00
parent c6fd4f51f4
commit 0ebc3adf4a
6 changed files with 138 additions and 21 deletions
+26 -2
View File
@@ -15,7 +15,7 @@ var htmlRegex = regexp.MustCompile(`<[^>]*>`)
// SyncProclamations fetches data from the API, cleans it, and updates the local DB.
// It returns the slice of proclamations so the UI can update immediately.
func SyncProclamations(database *gorm.DB) ([]db.Proclamation, error) {
fullURL := "https://portal.rhemawavetech.com/api/v1/proclamations"
fullURL := "https://portal.radiantwavetech.com/api/v1/proclamations"
logger.Debug("Syncronizing proclamations. URL: %s", fullURL)
proclamations, err := netreq.GetJSON[db.Proclamation](fullURL)
@@ -93,7 +93,7 @@ func SyncProclamations(database *gorm.DB) ([]db.Proclamation, error) {
}
func SyncCategories(database *gorm.DB) ([]db.ProclamationCategory, error) {
fullURL := "https://portal.rhemawavetech.com/api/v1/categories"
fullURL := "https://portal.radiantwavetech.com/api/v1/categories"
categories, err := netreq.GetJSON[db.ProclamationCategory](fullURL)
if err != nil {
logger.Error("Category sync failed, skipping update: %v", err)
@@ -118,3 +118,27 @@ func SyncCategories(database *gorm.DB) ([]db.ProclamationCategory, error) {
logger.Info("Successfully synced proclamation categories: %d", len(categories))
return categories, nil
}
func SyncFrequencies(database *gorm.DB) ([]db.SolfeggioFrequency, error) {
fullURL := "https://portal.radiantwavetech.com/api/v1/frequencies"
frequencies, err := netreq.GetJSON[db.SolfeggioFrequency](fullURL)
if err != nil {
logger.Error("Frequency sync failed, skipping update: %v", err)
return nil, err
}
err = database.Transaction(func(tx *gorm.DB) error {
if err := tx.Where("1 = 1").Delete(&db.SolfeggioFrequency{}).Error; err != nil {
return err
}
if err := tx.Save(&frequencies).Error; err != nil {
return err
}
return nil
})
if err != nil {
logger.Error("failed to sync solfeggio frequencies: %v", err)
return nil, err
}
logger.Info("Succesfully synced solfeggio frequencies: %d", len(frequencies))
return frequencies, nil
}