aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_stations.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-12 21:16:58 -0400
committerhistoria <[not public]>2026-07-12 21:16:58 -0400
commitf601a40776843f6196221e74ba502c571a5b1bcd (patch)
treea5b3fc0ae5b8774d642439fc4d369b96bf3932ab /internal/admin/api_stations.go
parentbeb0b73a9e56fdc717d55bbf1a1c7c5b49d4c6a4 (diff)
downloadthehouseoficarus-f601a40776843f6196221e74ba502c571a5b1bcd.tar.gz
fix(admin): standardize most search dropdowns and radio buttons
Diffstat (limited to 'internal/admin/api_stations.go')
-rw-r--r--internal/admin/api_stations.go37
1 files changed, 37 insertions, 0 deletions
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)
+}