feat: nested geofences — area_manager access to all child areas of a region - #112
Open
dadofsambonzuki wants to merge 1 commit into
Open
feat: nested geofences — area_manager access to all child areas of a region#112dadofsambonzuki wants to merge 1 commit into
dadofsambonzuki wants to merge 1 commit into
Conversation
Geofencing a country-level area now grants access to all communities within it via polygon containment. No more manual ID syncing required. - check_geofence(): direct ID match still works; falls back to spatial check when target area is not directly listed - add_area: area managers can create new areas inside their geofenced regions (previously blocked entirely) - Shared helpers: area_is_contained_in_geofence(), geo_json_is_within_geofence(), point_is_inside_any(), inner_centroid_of_geometries() Closes #111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #111
Summary
Replaces the flat-list geofence model with spatial nesting. Geofencing a country-level area now grants access to all communities within it — no more manual ID syncing.
What changed
check_geofence()(src/service/area.rs)add_areahandler (src/rpc/area/add_area.rs)"Cannot add new areas when your geofence is set").Shared helpers
area_is_contained_in_geofence()— spatial check for existing areas (uses geometry centroid + polygon containment).geo_json_is_within_geofence()— spatial check for incoming GeoJSON (used byadd_areabefore the area exists in the DB).inner_centroid_of_geometries()/point_is_inside_any()— reusable geometry utilities.Tests (6 new/changed)
check_geofence_allows_nested_child_area_within_geofenced_parentgeo_json_is_within_geofence_detects_containmentarea_manager_can_create_area_inside_geofenced_parentarea_manager_with_geofence_is_rejected_when_outside(renamed)area_manager_with_geofence_cannot_delete_unfenced_area(fixed)Backward compatibility
Example: UK area manager
Before:
After: