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
+1
View File
@@ -20,6 +20,7 @@ type Store interface {
DeleteCollection(id string) error
SaveFeature(f Feature)
ListFeaturesByCollection(collectionID string) []Feature
ListFeaturesAll() []Feature
GetFeature(featureID string) (Feature, error)
DeleteFeature(featureID string) error
SaveAsset(a Asset)
+10
View File
@@ -195,6 +195,16 @@ func (s *MemoryStore) ListFeaturesByCollection(collectionID string) []Feature {
return result
}
func (s *MemoryStore) ListFeaturesAll() []Feature {
s.mu.RLock()
defer s.mu.RUnlock()
result := make([]Feature, 0, len(s.features))
for _, f := range s.features {
result = append(result, f)
}
return result
}
func (s *MemoryStore) GetFeature(featureID string) (Feature, error) {
s.mu.RLock()
defer s.mu.RUnlock()
+23
View File
@@ -260,6 +260,29 @@ func (s *PostgresStore) ListFeaturesByCollection(collectionID string) []Feature
return result
}
func (s *PostgresStore) ListFeaturesAll() []Feature {
rows, err := s.db.Query(
`SELECT id, collection_id, owner_key, type, geometry, properties, created_at, updated_at
FROM features ORDER BY created_at`,
)
if err != nil {
return nil
}
defer rows.Close()
var result []Feature
for rows.Next() {
var f Feature
var geom, props []byte
if err := rows.Scan(&f.ID, &f.CollectionID, &f.OwnerKey, &f.Type, &geom, &props, &f.CreatedAt, &f.UpdatedAt); err != nil {
return result
}
_ = json.Unmarshal(geom, &f.Geometry)
_ = json.Unmarshal(props, &f.Properties)
result = append(result, f)
}
return result
}
func (s *PostgresStore) GetFeature(featureID string) (Feature, error) {
var f Feature
var geom, props []byte