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
+26
View File
@@ -0,0 +1,26 @@
package netreq
import (
"fmt"
"testing"
"rhemawavetech.com/rhemawave/internal/db"
)
func TestGet(t *testing.T) {
url := "http://localhost:5173/api/v1/proclamations"
// Explicitly tell GetJSON to return a slice of db.Proclamation
proclamations, err := GetJSON[db.Proclamation](url)
if err != nil {
t.Fatalf("GetJSON failed: %v", err)
}
if len(proclamations) == 0 {
t.Fatal("GetJSON returned no records")
}
// You can now inspect the actual struct fields instead of raw strings
fmt.Printf("Fetched %d records. First ID: %s\n", len(proclamations), proclamations[0].ID)
}