Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM-851] convert to post request for polygon validation #277

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down
1 change: 0 additions & 1 deletion app/Services/PolygonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
roguenet marked this conversation as resolved.
Show resolved Hide resolved

try {
$criteriaSite->save();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Get validation results for a polygon
summary: Run validation for a polygon
parameters:
- in: query
name: uuid
Expand Down
4 changes: 2 additions & 2 deletions openapi-src/V2/paths/_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions resources/docs/swagger-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions routes/api_v2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
Loading