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 #619

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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 @@ -32,6 +32,7 @@ public function clipOverlappingPolygonsBySite(string $uuid)
'entity_id' => $site->id,
'entity_type' => get_class($site),
'is_acknowledged' => false,
'name' => 'Polygon Fix',
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id);
dispatch($job);
Expand Down Expand Up @@ -89,6 +90,7 @@ public function clipOverlappingPolygonsOfProjectBySite(string $uuid)
'entity_type' => get_class($sitePolygon),
'created_by' => $user->id,
'is_acknowledged' => false,
'name' => 'Polygon Fix',
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $uniquePolygonUuids, $user->id);
dispatch($job);
Expand Down Expand Up @@ -148,6 +150,7 @@ public function clipOverlappingPolygons(Request $request)
'entity_type' => get_class($entity),
'created_by' => $user->id,
'is_acknowledged' => false,
'name' => 'Polygon Fix',
]);
$job = new FixPolygonOverlapJob($delayedJob->id, $polygonUuids, $user->id);
dispatch($job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ function ($attribute, $value, $fail) {
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
'name' => 'Polygon Upload',
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -412,6 +413,7 @@ public function uploadShapefile(Request $request)
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
'name' => 'Polygon Upload',
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -639,6 +641,7 @@ public function uploadGeoJSONFile(Request $request)
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
'name' => 'Polygon Upload',
]);

$job = new InsertGeojsonToDBJob(
Expand Down Expand Up @@ -1251,6 +1254,7 @@ public function runSiteValidationPolygon(Request $request)
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
'name' => 'Polygon Validation',
]);
$job = new RunSitePolygonsValidationJob($delayedJob->id, $sitePolygonsUuids);
dispatch($job);
Expand Down Expand Up @@ -1280,6 +1284,7 @@ public function runPolygonsValidation(Request $request)
'entity_id' => $entity->id,
'entity_type' => get_class($entity),
'is_acknowledged' => false,
'name' => 'Polygon Validation',
]);
$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', 'is_acknowledged'];
protected $fillable = ['uuid', 'status', 'status_code', 'payload', 'entity_type', 'entity_id', 'created_by', 'is_acknowledged', 'name'];

protected $casts = [
'uuid' => 'string',
Expand Down
27 changes: 27 additions & 0 deletions database/migrations/2024_12_17_150134_add_name_to_jobs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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->string('name')->nullable()->after('id');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('delayed_jobs', function (Blueprint $table) {
$table->dropColumn('name');
});
}
};