Add public GeoJSON features API and load public 3D objects on maps.
CI / test (push) Successful in 3s

Expose GET /v1/features/public (optional kind filter) and update Leaflet/MapLibre demos to render all public 3D assets globally, while still merging owner collections after login.

Made-with: Cursor
This commit is contained in:
2026-03-02 22:21:21 +00:00
parent b833c2ac6e
commit 59c9a719e0
8 changed files with 235 additions and 24 deletions
+10
View File
@@ -41,6 +41,7 @@ func (a *API) Routes() http.Handler {
mux.HandleFunc("DELETE /v1/collections/{id}", a.deleteCollection)
mux.HandleFunc("POST /v1/collections/{id}/features", a.createFeature)
mux.HandleFunc("GET /v1/collections/{id}/features", a.listFeatures)
mux.HandleFunc("GET /v1/features/public", a.listPublicFeatures)
mux.HandleFunc("DELETE /v1/features/{id}", a.deleteFeature)
mux.HandleFunc("POST /v1/assets", a.createAsset)
mux.HandleFunc("PATCH /v1/assets/{id}", a.patchAsset)
@@ -369,6 +370,15 @@ func (a *API) listFeatures(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]interface{}{"features": features})
}
func (a *API) listPublicFeatures(w http.ResponseWriter, r *http.Request) {
kind := r.URL.Query().Get("kind")
if kind != "" && kind != "3d" && kind != "image" {
writeErr(w, app.ErrBadRequest)
return
}
writeJSON(w, http.StatusOK, map[string]interface{}{"features": a.service.ListPublicFeatures(kind)})
}
func (a *API) deleteFeature(w http.ResponseWriter, r *http.Request) {
user, err := a.authUser(r)
if err != nil {