diff --git a/app/Http/Controllers/V2/Terrafund/TerrafundEditGeometryController.php b/app/Http/Controllers/V2/Terrafund/TerrafundEditGeometryController.php index fb11c14ee..88bcbfabc 100644 --- a/app/Http/Controllers/V2/Terrafund/TerrafundEditGeometryController.php +++ b/app/Http/Controllers/V2/Terrafund/TerrafundEditGeometryController.php @@ -84,7 +84,12 @@ public function updateProjectCentroid($polygonGeometry) } else { Log::warning("Centroid data for project UUID: $project->uuid is malformed."); } - Log::info("Updated project centroid for project UUID: $project->uuid with lat: {$centroid['lat']}, lng: {$centroid['lng']}"); + if (is_array($centroid) && isset($centroid['lat']) && isset($centroid['lng'])) { + Log::info("Updated project centroid for project UUID: $project->uuid with lat: {$centroid['lat']}, lng: {$centroid['lng']}"); + } else { + Log::error('Centroid is not properly defined. Centroid data: ' . print_r($centroid, true)); + } + } else { Log::warning("Project with UUID $relatedSite->project_id not found."); } diff --git a/app/Services/PolygonService.php b/app/Services/PolygonService.php index 9e8c5ab8a..fd323c3a5 100644 --- a/app/Services/PolygonService.php +++ b/app/Services/PolygonService.php @@ -83,7 +83,6 @@ public function createCriteriaSite($polygonId, $criteriaId, $valid): bool|string $criteriaSite->polygon_id = $polygonId; $criteriaSite->criteria_id = $criteriaId; $criteriaSite->valid = $valid; - $criteriaSite->created_by = Auth::user()?->id; try { $criteriaSite->save(); diff --git a/openapi-src/V2/paths/Terrafund/get-v2-terrafund-validation-polygon.yml b/openapi-src/V2/paths/Terrafund/get-v2-terrafund-validation-polygon.yml index 1f565764b..310abf699 100644 --- a/openapi-src/V2/paths/Terrafund/get-v2-terrafund-validation-polygon.yml +++ b/openapi-src/V2/paths/Terrafund/get-v2-terrafund-validation-polygon.yml @@ -1,4 +1,4 @@ -summary: Get validation results for a polygon +summary: Run validation for a polygon parameters: - in: query name: uuid diff --git a/openapi-src/V2/paths/_index.yml b/openapi-src/V2/paths/_index.yml index c4d6c211a..4a3158a6a 100644 --- a/openapi-src/V2/paths/_index.yml +++ b/openapi-src/V2/paths/_index.yml @@ -2515,13 +2515,13 @@ get: $ref: './Exports/get-v2-entity-export-uuid.yml' '/v2/terrafund/validation/polygon': - get: + post: $ref: './Terrafund/get-v2-terrafund-validation-polygon.yml' '/v2/terrafund/validation/criteria-data': get: $ref: './Terrafund/get-v2-terrafund-validation-criteria-data.yml' '/v2/terrafund/validation/sitePolygons': - get: + post: $ref: './Terrafund/get-v2-terrafund-validation-sitepolygons.yml' '/v2/terrafund/validation/site': get: diff --git a/resources/docs/swagger-v2.yml b/resources/docs/swagger-v2.yml index 968bbc625..1965c3011 100644 --- a/resources/docs/swagger-v2.yml +++ b/resources/docs/swagger-v2.yml @@ -94312,8 +94312,8 @@ paths: schema: type: file /v2/terrafund/validation/polygon: - get: - summary: Get validation results for a polygon + post: + summary: Run validation for a polygon parameters: - in: query name: uuid @@ -94380,7 +94380,7 @@ paths: type: integer description: 'Indicates if the criteria is valid or not (1 for valid, 0 for invalid)' /v2/terrafund/validation/sitePolygons: - get: + post: summary: Run validation for all polygons in a site parameters: - in: query diff --git a/routes/api_v2.php b/routes/api_v2.php index c4caa12ff..9aedba714 100644 --- a/routes/api_v2.php +++ b/routes/api_v2.php @@ -638,8 +638,8 @@ Route::get('/validation/overlapping', [TerrafundCreateGeometryController::class, 'validateOverlapping']); Route::get('/validation/estimated-area', [TerrafundCreateGeometryController::class, 'validateEstimatedArea']); Route::get('/validation/table-data', [TerrafundCreateGeometryController::class, 'validateDataInDB']); - Route::get('/validation/polygon', [TerrafundCreateGeometryController::class, 'getValidationPolygon']); - Route::get('/validation/sitePolygons', [TerrafundCreateGeometryController::class, 'getSiteValidationPolygon']); + Route::post('/validation/polygon', [TerrafundCreateGeometryController::class, 'getValidationPolygon']); + Route::post('/validation/sitePolygons', [TerrafundCreateGeometryController::class, 'getSiteValidationPolygon']); Route::get('/validation/site', [TerrafundCreateGeometryController::class, 'getCurrentSiteValidation']); Route::get('/polygon/{uuid}', [TerrafundEditGeometryController::class, 'getSitePolygonData']);