Skip to content

Add external_ids, place_status, and user_verified fields#54

Merged
koinsaari merged 1 commit intomainfrom
feature/external-ids-and-place-status
May 3, 2026
Merged

Add external_ids, place_status, and user_verified fields#54
koinsaari merged 1 commit intomainfrom
feature/external-ids-and-place-status

Conversation

@koinsaari
Copy link
Copy Markdown
Contributor

Summary

Schema prerequisites for the ingestion service — must be in place before inwheel-ingestion starts writing to the API.

Changes

Migration 000006

  • places.external_ids JSONB — stores identifiers from external sources keyed by source name (e.g. {"osm": "node/123456"}). Used by the ingestion service to find existing places during OSM diff processing without matching on coordinates or name. GIN index for fast JSONB lookups.
  • places.status place_status — enum active | closed | osm_removed. Protects user-contributed accessibility data when OSM removes a place: instead of hard-deleting, the ingestion service sets osm_removed and keeps the record.
  • accessibility_profiles.user_verified BOOLEAN DEFAULT FALSE — set to true when a human user explicitly submits accessibility data. The ingestion service checks this before overwriting a profile with automated data.

Models

  • PlaceStatus type with active, closed, osm_removed constants
  • ExternalIDs custom JSONB map type (same Scan/Value pattern as PlaceTags)
  • ExternalIDs and Status fields on Place
  • UserVerified field on AccessibilityProfile

OpenAPI

  • PlaceStatus enum schema
  • external_ids (read/write) and status (readOnly) on Place
  • user_verified (readOnly) on AccessibilityProfile
  • Regenerated server.gen.go

All new columns have safe defaults — no existing data or tests break.

Closes #53

Comment thread pkg/models/place.go Outdated
@koinsaari koinsaari force-pushed the feature/external-ids-and-place-status branch from bf22342 to e466786 Compare May 3, 2026 18:55
@claude
Copy link
Copy Markdown

claude Bot commented May 3, 2026

Claude finished @koinsaari's task in 1m 19s —— View job


Review complete

  • Read changed files
  • Check if previous bug (missing gorm:"default:active") was fixed
  • Check for any new must-fix issues
  • Post review summary

The previously flagged bug is fixed: pkg/models/place.go:96 now has gorm:"type:place_status;default:active", so GORM will skip the zero-value field on INSERT and let the DB default kick in rather than sending an invalid '' to the enum column.

No other must-fix issues found. The migration order is correct (type created before column, column dropped before type in the down migration), ExternalIDs correctly returns SQL NULL for nil maps on a nullable column, and UserVerified bool requires no GORM default tag since the DB has DEFAULT FALSE and GORM v2 Create includes zero values explicitly.

PR looks good to merge.

- Add migration 000006: external_ids JSONB + GIN index and status
  place_status enum column on places; user_verified boolean on
  accessibility_profiles
- Add PlaceStatus type and ExternalIDs custom JSONB map type to
  pkg/models/place.go; add ExternalIDs and Status fields to Place
- Add UserVerified bool to AccessibilityProfile in
  pkg/models/accessibility.go
- Update OpenAPI spec with PlaceStatus enum; external_ids and status
  (readOnly) on Place; user_verified (readOnly) on AccessibilityProfile
- Regenerate internal/api/v1/server.gen.go
@koinsaari koinsaari force-pushed the feature/external-ids-and-place-status branch from e466786 to 9f53b42 Compare May 3, 2026 18:59
@InWheelOrg InWheelOrg deleted a comment from claude Bot May 3, 2026
@InWheelOrg InWheelOrg deleted a comment from claude Bot May 3, 2026
@koinsaari koinsaari merged commit 009d937 into main May 3, 2026
7 of 8 checks passed
@koinsaari koinsaari deleted the feature/external-ids-and-place-status branch May 3, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add external_ids and place_status to places schema

1 participant