feat: update area management to implement hard delete and adjust related references
This commit is contained in:
+2
-1
@@ -46,7 +46,7 @@ Authorization: Bearer <token>
|
||||
|
||||
## Public Reference / Public Access
|
||||
- `GET /areas`
|
||||
active municipal areas
|
||||
municipal areas
|
||||
- `GET /interventions/{token}`
|
||||
public external-team summary link
|
||||
- `GET /open-data/reports`
|
||||
@@ -115,6 +115,7 @@ Authorization: Bearer <token>
|
||||
- `POST /admin/areas`
|
||||
- `PATCH /admin/areas/{id}`
|
||||
- `DELETE /admin/areas/{id}`
|
||||
deletes area and clears linked `reports.area_id` and `teams.area_id`
|
||||
area polygon must stay inside allowed Bari municipal boundary
|
||||
- `POST /admin/teams`
|
||||
- `PATCH /admin/teams/{id}`
|
||||
|
||||
@@ -28,7 +28,7 @@ Schema truth is `migrations/*.sql`. This file is compact human map of current DB
|
||||
- `report_categories`
|
||||
citizen-facing report categories, `active`
|
||||
- `areas`
|
||||
named municipal areas, GeoJSON polygon in `boundary_geojson`, `active`
|
||||
named municipal areas, GeoJSON polygon in `boundary_geojson`
|
||||
- `team_categories`
|
||||
category of external intervention team
|
||||
- `teams`
|
||||
@@ -92,7 +92,9 @@ Schema truth is `migrations/*.sql`. This file is compact human map of current DB
|
||||
- `reward_events(report_id, reason)` unique
|
||||
- `api_tokens.token_hash` unique
|
||||
- `intervention_access_links.token_hash` unique
|
||||
- category/team/area delete behavior is soft delete via `active = FALSE`
|
||||
- category/team delete behavior is soft delete via `active = FALSE`
|
||||
- area delete behavior is hard delete; linked `reports.area_id` and `teams.area_id`
|
||||
become `NULL`
|
||||
|
||||
## Current Query Model
|
||||
- No generated ORM models
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ public revocable link generated by operator/admin.
|
||||
1. Register/login.
|
||||
2. `POST /reports` with category, coordinates, address, description, optional media array.
|
||||
3. Backend first rejects coordinates outside Bari municipal boundary.
|
||||
4. Backend infers `area_id` by GeoJSON polygon match when possible.
|
||||
4. Backend infers `area_id` by GeoJSON polygon match when possible from existing areas.
|
||||
5. Report starts `OPEN`, status history row inserted.
|
||||
6. Citizen can:
|
||||
- list own reports
|
||||
|
||||
@@ -82,14 +82,14 @@ moderate abuse, and inspect operational stats.
|
||||
- soft-delete categories
|
||||
- create/update areas
|
||||
area polygons must stay inside Bari municipal boundary
|
||||
- soft-delete areas
|
||||
- delete areas
|
||||
- create/update teams
|
||||
- soft-delete teams
|
||||
- list users, update roles, ban/unban
|
||||
- global stats including area/category/team resolution aggregates
|
||||
|
||||
### Public Data
|
||||
- active area list
|
||||
- area list
|
||||
- anonymized resolved/closed open-data export
|
||||
- public intervention token endpoint
|
||||
- open-data output filtered to Bari municipal boundary
|
||||
|
||||
@@ -85,9 +85,6 @@
|
||||
"Area": {
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"boundary_geojson": {
|
||||
"$ref": "#/components/schemas/GeoJsonObject"
|
||||
},
|
||||
@@ -1713,7 +1710,7 @@
|
||||
},
|
||||
"/api/v1/admin/areas/{id}": {
|
||||
"delete": {
|
||||
"description": "Soft-deletes an existing municipal area by setting active to false.",
|
||||
"description": "Deletes an existing municipal area and clears linked report/team area references.",
|
||||
"operationId": "AdminController.deleteArea",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -2268,7 +2265,7 @@
|
||||
},
|
||||
"/api/v1/areas": {
|
||||
"get": {
|
||||
"description": "Lists active municipal areas.",
|
||||
"description": "Lists municipal areas.",
|
||||
"operationId": "PublicController.listAreas",
|
||||
"parameters": [ ],
|
||||
"responses": {
|
||||
|
||||
Reference in New Issue
Block a user