feat: add soft-delete functionality for categories, areas, and teams in Admin service

This commit is contained in:
gabdevele
2026-06-15 15:10:52 +02:00 Unverified
parent aab7420706
commit bf85168914
8 changed files with 262 additions and 0 deletions
+3
View File
@@ -111,11 +111,14 @@ Authorization: Bearer <token>
## Admin Reference Data
- `POST /admin/categories`
- `PATCH /admin/categories/{id}`
- `DELETE /admin/categories/{id}`
- `POST /admin/areas`
- `PATCH /admin/areas/{id}`
- `DELETE /admin/areas/{id}`
area polygon must stay inside allowed Bari municipal boundary
- `POST /admin/teams`
- `PATCH /admin/teams/{id}`
- `DELETE /admin/teams/{id}`
- `GET /admin/users`
- `PATCH /admin/users/{id}/roles`
- `PATCH /admin/users/{id}/ban`
+1
View File
@@ -92,6 +92,7 @@ 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`
## Current Query Model
- No generated ORM models
+3
View File
@@ -79,9 +79,12 @@ moderate abuse, and inspect operational stats.
### Admin
- create/update categories
- soft-delete categories
- create/update areas
area polygons must stay inside Bari municipal boundary
- soft-delete areas
- create/update teams
- soft-delete teams
- list users, update roles, ban/unban
- global stats including area/category/team resolution aggregates
+135
View File
@@ -1712,6 +1712,51 @@
}
},
"/api/v1/admin/areas/{id}": {
"delete": {
"description": "Soft-deletes an existing municipal area by setting active to false.",
"operationId": "AdminController.deleteArea",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OkResponse"
}
}
},
"description": "Deleted area result."
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"bearerAuth": [ ]
}
],
"summary": "Delete area",
"tags": [
"Admin"
]
},
"patch": {
"description": "Updates an existing municipal area.",
"operationId": "AdminController.updateArea",
@@ -1816,6 +1861,51 @@
}
},
"/api/v1/admin/categories/{id}": {
"delete": {
"description": "Soft-deletes an existing report category by setting active to false.",
"operationId": "AdminController.deleteCategory",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OkResponse"
}
}
},
"description": "Deleted category result."
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"bearerAuth": [ ]
}
],
"summary": "Delete category",
"tags": [
"Admin"
]
},
"patch": {
"description": "Updates an existing report category.",
"operationId": "AdminController.updateCategory",
@@ -2075,6 +2165,51 @@
}
},
"/api/v1/admin/teams/{id}": {
"delete": {
"description": "Soft-deletes an existing intervention team by setting active to false.",
"operationId": "AdminController.deleteTeam",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OkResponse"
}
}
},
"description": "Deleted team result."
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"bearerAuth": [ ]
}
],
"summary": "Delete team",
"tags": [
"Admin"
]
},
"patch": {
"description": "Updates an existing intervention team.",
"operationId": "AdminController.updateTeam",