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-1531] delayed job with data #610

Merged
merged 15 commits into from
Dec 13, 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 @@ -31,6 +31,7 @@ public function clipOverlappingPolygonsBySite(string $uuid)
'created_by' => $user->id,
'entity_id' => $site->id,
'entity_type' => get_class($site),
'is_acknowledged' => false,
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id);
dispatch($job);
Expand Down Expand Up @@ -87,6 +88,7 @@ public function clipOverlappingPolygonsOfProjectBySite(string $uuid)
'entity_id' => $sitePolygon->id,
'entity_type' => get_class($sitePolygon),
'created_by' => $user->id,
'is_acknowledged' => false,
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $uniquePolygonUuids, $user->id);
dispatch($job);
Expand Down Expand Up @@ -145,6 +147,7 @@ public function clipOverlappingPolygons(Request $request)
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'created_by' => $user->id,
'is_acknowledged' => false,
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id);
dispatch($job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ function ($attribute, $value, $fail) {
'created_by' => $user->id,
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -410,6 +411,7 @@ public function uploadShapefile(Request $request)
'created_by' => $user->id,
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -636,6 +638,7 @@ public function uploadGeoJSONFile(Request $request)
'created_by' => $user->id,
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -1247,6 +1250,7 @@ public function runSiteValidationPolygon(Request $request)
'created_by' => $user->id,
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
]);
$job = new RunSitePolygonsValidationJob($delayedJob->id, $sitePolygonsUuids);
dispatch($job);
Expand Down Expand Up @@ -1275,6 +1279,7 @@ public function runPolygonsValidation(Request $request)
'created_by' => $user->id,
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
]);
$job = new RunSitePolygonsValidationJob($delayedJob->id, $uuids);
dispatch($job);
Expand Down
2 changes: 1 addition & 1 deletion app/Models/DelayedJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DelayedJob extends Model

protected $table = 'delayed_jobs';

protected $fillable = ['uuid', 'status', 'status_code', 'payload', 'entity_type', 'entity_id', 'created_by'];
protected $fillable = ['uuid', 'status', 'status_code', 'payload', 'entity_type', 'entity_id', 'created_by', 'is_acknowledged'];

protected $casts = [
'uuid' => 'string',
Expand Down
41 changes: 41 additions & 0 deletions database/migrations/2024_12_09_212253_change_is_cleared_values.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('delayed_jobs', function (Blueprint $table) {
$table->unsignedBigInteger('created_by')->nullable()->change();

$table->dropColumn('is_cleared');

$table->boolean('is_acknowledged')->default(true);
});
}

/**
* Reverse the migrations.
*/
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')) {
$table->boolean('is_cleared')->default(false);
}
});
}
};
Loading