From a367e9932ae58c06db61365a0c83614629ffb47a Mon Sep 17 00:00:00 2001 From: JORGE Date: Tue, 10 Dec 2024 14:21:51 -0400 Subject: [PATCH] [TM-1531] change created_by type, change to is_acknowledge --- .../TerrafundClipGeometryController.php | 6 +++--- .../TerrafundCreateGeometryController.php | 10 +++++----- ...4_12_09_212253_change_is_cleared_values.php | 18 +++++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php index 4f4b22f4..04205eda 100644 --- a/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php +++ b/app/Http/Controllers/V2/Terrafund/TerrafundClipGeometryController.php @@ -31,7 +31,7 @@ public function clipOverlappingPolygonsBySite(string $uuid) 'created_by' => $user->id, 'entity_id' => $site->id, 'entity_type' => get_class($site), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id); dispatch($job); @@ -88,7 +88,7 @@ public function clipOverlappingPolygonsOfProjectBySite(string $uuid) 'entity_id' => $sitePolygon->id, 'entity_type' => get_class($sitePolygon), 'created_by' => $user->id, - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new FixPolygonOverlapJob($delayedJob->id, $uniquePolygonUuids, $user->id); dispatch($job); @@ -147,7 +147,7 @@ public function clipOverlappingPolygons(Request $request) 'entity_id' => $entity->id, 'entity_type' => get_class($entity), 'created_by' => $user->id, - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id); dispatch($job); diff --git a/app/Http/Controllers/V2/Terrafund/TerrafundCreateGeometryController.php b/app/Http/Controllers/V2/Terrafund/TerrafundCreateGeometryController.php index 0508c6bc..a2e41ca2 100755 --- a/app/Http/Controllers/V2/Terrafund/TerrafundCreateGeometryController.php +++ b/app/Http/Controllers/V2/Terrafund/TerrafundCreateGeometryController.php @@ -244,7 +244,7 @@ function ($attribute, $value, $fail) { 'created_by' => $user->id, 'entity_id' => $entity->id, 'entity_type' => get_class($entity), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new InsertGeojsonToDBJob( @@ -411,7 +411,7 @@ public function uploadShapefile(Request $request) 'created_by' => $user->id, 'entity_id' => $entity->id, 'entity_type' => get_class($entity), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new InsertGeojsonToDBJob( @@ -638,7 +638,7 @@ public function uploadGeoJSONFile(Request $request) 'created_by' => $user->id, 'entity_id' => $entity->id, 'entity_type' => get_class($entity), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new InsertGeojsonToDBJob( @@ -1250,7 +1250,7 @@ public function runSiteValidationPolygon(Request $request) 'created_by' => $user->id, 'entity_id' => $entity->id, 'entity_type' => get_class($entity), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new RunSitePolygonsValidationJob($delayedJob->id, $sitePolygonsUuids); dispatch($job); @@ -1279,7 +1279,7 @@ public function runPolygonsValidation(Request $request) 'created_by' => $user->id, 'entity_id' => $entity->id, 'entity_type' => get_class($entity), - 'is_acknowledged' => false + 'is_acknowledged' => false, ]); $job = new RunSitePolygonsValidationJob($delayedJob->id, $uuids); dispatch($job); diff --git a/database/migrations/2024_12_09_212253_change_is_cleared_values.php b/database/migrations/2024_12_09_212253_change_is_cleared_values.php index 3e304a2c..972664bb 100644 --- a/database/migrations/2024_12_09_212253_change_is_cleared_values.php +++ b/database/migrations/2024_12_09_212253_change_is_cleared_values.php @@ -11,12 +11,11 @@ public function up(): void { Schema::table('delayed_jobs', function (Blueprint $table) { - if (Schema::hasColumn('delayed_jobs', 'is_cleared')) { - $table->dropColumn('is_cleared'); - } - if (!Schema::hasColumn('delayed_jobs', 'is_acknowledged')) { - $table->boolean('is_acknowledged')->default(true); - } + $table->unsignedBigInteger('created_by')->nullable()->change(); + + $table->dropColumn('is_cleared'); + + $table->boolean('is_acknowledged')->default(true); }); } @@ -26,10 +25,15 @@ public function up(): void public function down(): void { Schema::table('delayed_jobs', function (Blueprint $table) { + if (Schema::hasColumn('delayed_jobs', 'createdBy')) { + $table->string('createdBy')->nullable()->change(); + } + if (Schema::hasColumn('delayed_jobs', 'is_acknowledged')) { $table->dropColumn('is_acknowledged'); } - if (!Schema::hasColumn('delayed_jobs', 'is_cleared')) { + + if (! Schema::hasColumn('delayed_jobs', 'is_cleared')) { $table->boolean('is_cleared')->default(false); } });