feat: add active hospital catalog API

This commit is contained in:
2026-08-28 10:40:57 +07:00
parent 8dd880003d
commit 1ee0cfb7f2
4 changed files with 93 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ func main() {
adminProtected := func(handler http.Handler) http.Handler {
return apphttp.BearerAuth(cfg.DBSettingsToken, handler)
}
catalogProtected := func(handler http.Handler) http.Handler {
return apphttp.BearerAuth(cfg.BearerToken, handler)
}
mux := http.NewServeMux()
mux.Handle("GET /api/cpone/paket", protected(http.HandlerFunc(handler.ListPaket)))
@@ -62,6 +65,7 @@ func main() {
mux.Handle("GET /api/cpone/database-settings", adminProtected(http.HandlerFunc(settingsHandler.List)))
mux.Handle("GET /api/cpone/database-settings/{kodeRs}", adminProtected(http.HandlerFunc(settingsHandler.Get)))
mux.Handle("POST /api/cpone/database-settings", adminProtected(http.HandlerFunc(settingsHandler.Store)))
mux.Handle("GET /api/cpone/hospitals", catalogProtected(http.HandlerFunc(settingsHandler.ListHospitals)))
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)