From d26e63ca1b3c90f001932e099f9384e207b6f83a Mon Sep 17 00:00:00 2001 From: Patrick Britton Date: Tue, 17 Feb 2026 18:06:46 -0600 Subject: [PATCH] fix: Add /feed/personal route + lazy neighborhood group creation - Add GET /feed/personal alias for /feed (Flutter uses this endpoint) - Fix 'Neighborhood unavailable' board bug: GetMyNeighborhood now creates the neighborhood group lazily if group_id is NULL in the seed, matching the same auto-create logic as the Detect endpoint Co-Authored-By: Claude Sonnet 4.6 --- go-backend/cmd/api/main.go | 1 + .../internal/handlers/neighborhood_handler.go | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/go-backend/cmd/api/main.go b/go-backend/cmd/api/main.go index f555612..65dc428 100644 --- a/go-backend/cmd/api/main.go +++ b/go-backend/cmd/api/main.go @@ -350,6 +350,7 @@ func main() { authorized.POST("/posts/:id/reactions/toggle", postHandler.ToggleReaction) authorized.POST("/posts/:id/comments", postHandler.CreateComment) authorized.GET("/feed", postHandler.GetFeed) + authorized.GET("/feed/personal", postHandler.GetFeed) authorized.POST("/beacons", postHandler.CreateBeacon) authorized.GET("/beacons/nearby", postHandler.GetNearbyBeacons) authorized.POST("/beacons/:id/vouch", postHandler.VouchBeacon) diff --git a/go-backend/internal/handlers/neighborhood_handler.go b/go-backend/internal/handlers/neighborhood_handler.go index bab0150..b4292cb 100644 --- a/go-backend/internal/handlers/neighborhood_handler.go +++ b/go-backend/internal/handlers/neighborhood_handler.go @@ -617,6 +617,27 @@ func (h *NeighborhoodHandler) GetMyNeighborhood(c *gin.Context) { }, } + // If the seed has no group yet, create one now (lazy creation) + if groupID == nil { + seed := &seedRow{ + ID: seedID, + Name: name, + City: city, + State: state, + ZipCode: zipCode, + Country: country, + Lat: lat, + Lng: lng, + RadiusMeters: radiusMeters, + } + newGroupID, createErr := h.createNeighborhoodGroup(ctx, seed) + if createErr != nil { + log.Printf("[Neighborhood] GetMyNeighborhood lazy group creation error: %v", createErr) + } else { + groupID = &newGroupID + } + } + if groupID != nil { var groupName string var memberCount int