aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_courses.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-30 19:27:37 -0400
committerhistoria <[not public]>2026-06-30 19:27:37 -0400
commitfee376102192dc6f24297a7b11324636ace3a07d (patch)
tree6c777cc71208b429eebdbdc5864b353d4af34a09 /internal/admin/api_courses.go
parent98bdef072c843fdd8ccdf85a9b54ab9d32d34187 (diff)
downloadthehouseoficarus-fee376102192dc6f24297a7b11324636ace3a07d.tar.gz
feat: admin gui object CRUD is much nicer
Diffstat (limited to 'internal/admin/api_courses.go')
-rw-r--r--internal/admin/api_courses.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/admin/api_courses.go b/internal/admin/api_courses.go
index 63b356c..facb8f2 100644
--- a/internal/admin/api_courses.go
+++ b/internal/admin/api_courses.go
@@ -10,15 +10,15 @@ import (
func (s *AdminServer) handleCourses(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodGet:
- ids, err := listYAMLFiles(s.dataDir, "courses")
+ tree, err := listYAMLTree(s.dataDir, "courses")
if err != nil {
writeJSON(w, map[string]any{"error": err.Error()})
return
}
- if ids == nil {
- ids = []string{}
+ if tree == nil {
+ tree = &YAMLTree{Root: []string{}, Dirs: map[string][]string{}}
}
- writeJSON(w, ids)
+ writeJSON(w, tree)
case http.MethodPost:
var m map[string]any
if err := readJSON(r, &m); err != nil {