feat: update area management to implement hard delete and adjust related references

This commit is contained in:
gabdevele
2026-06-15 15:50:12 +02:00 Unverified
parent bf85168914
commit 4f80d7f995
9 changed files with 30 additions and 24 deletions
+3 -7
View File
@@ -444,7 +444,9 @@ Json::Value AdminService::deleteArea(const auth::UserContext &user,
{
return failure("area_not_found");
}
db->execSqlSync("UPDATE areas SET active = FALSE WHERE id = ?", areaId);
db->execSqlSync("UPDATE teams SET area_id = NULL WHERE area_id = ?", areaId);
db->execSqlSync("UPDATE reports SET area_id = NULL WHERE area_id = ?", areaId);
db->execSqlSync("DELETE FROM areas WHERE id = ?", areaId);
return success();
}
@@ -474,12 +476,6 @@ Json::Value AdminService::updateArea(const auth::UserContext &user,
body["description"].asString(),
areaId);
}
if (isActiveField(body))
{
db->execSqlSync("UPDATE areas SET active = ? WHERE id = ?",
body["active"].asBool(),
areaId);
}
if (body["boundary_geojson"].isObject())
{
if (!isAreaInsideAllowedBoundary(body["boundary_geojson"]))