Add public GeoJSON features API and load public 3D objects on maps.
CI / test (push) Successful in 3s
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user