From f601a40776843f6196221e74ba502c571a5b1bcd Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 12 Jul 2026 21:16:58 -0400 Subject: fix(admin): standardize most search dropdowns and radio buttons --- internal/admin/api_stations.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 internal/admin/api_stations.go (limited to 'internal/admin/api_stations.go') diff --git a/internal/admin/api_stations.go b/internal/admin/api_stations.go new file mode 100644 index 0000000..411ed96 --- /dev/null +++ b/internal/admin/api_stations.go @@ -0,0 +1,37 @@ +package admin + +import ( + "net/http" +) + +func (s *AdminServer) handleStations(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + http.Error(w, "method not allowed", http.StatusMethodNotAllowed) + return + } + + items, err := s.itemStore.LoadAll() + if err != nil { + http.Error(w, "failed to load items", http.StatusInternalServerError) + return + } + + seen := map[string]bool{} + var stations []string + for _, def := range items { + if def.Craft != nil { + for _, c := range def.Craft { + for _, s := range c.Station { + if s != "" { + if !seen[s] { + seen[s] = true + stations = append(stations, s) + } + } + } + } + } + } + + writeJSON(w, stations) +} -- cgit v1.2.3