diff --git a/app/Filament/Admin/Resources/ElectionResource/RelationManagers/ScheduledJobRelationManager.php b/app/Filament/Admin/Resources/ElectionResource/RelationManagers/ScheduledJobRelationManager.php index 0c5c0e2..d04afd8 100644 --- a/app/Filament/Admin/Resources/ElectionResource/RelationManagers/ScheduledJobRelationManager.php +++ b/app/Filament/Admin/Resources/ElectionResource/RelationManagers/ScheduledJobRelationManager.php @@ -37,7 +37,10 @@ public function form(Form $form): Form ->mapWithKeys(fn (string $job) => [ $job => $job::name(), ]); - }), + }) + ->searchable() + ->preload() + ->required(), Select::make('cron') ->label(__('app.field.cron')) @@ -47,23 +50,18 @@ public function form(Form $form): Form Fieldset::make('source') ->label('Source') - ->columns(4) + ->columns(2) ->schema([ TextInput::make('source_url') ->label(__('app.field.source_url')) - ->columnSpan(3), - - TextInput::make('source_part') - ->label(__('app.field.source_part')), + ->columnSpanFull(), TextInput::make('source_username') - ->label(__('app.field.source_username')) - ->columnSpan(2), + ->label(__('app.field.source_username')), TextInput::make('source_password') ->label(__('app.field.source_password')) - ->password() - ->columnSpan(2), + ->password(), ]), ]); } @@ -80,7 +78,7 @@ public function table(Table $table): Table TextColumn::make('job') ->label(__('app.field.job')) ->description(fn (string $state) => $state, 'above') - ->formatStateUsing(fn (string $state) => $state::name()), + ->formatStateUsing(fn (string $state) => rescue(fn () => $state::name())), TextColumn::make('cron') ->label(__('app.field.cron')), diff --git a/app/Jobs/Europarl240609/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Records/FetchRecordsJob.php similarity index 93% rename from app/Jobs/Europarl240609/Records/FetchRecordsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Records/FetchRecordsJob.php index db31553..2773b39 100644 --- a/app/Jobs/Europarl240609/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Records/FetchRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Records; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Records; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -17,7 +17,7 @@ class FetchRecordsJob extends SchedulableJob { public static function name(): string { - return 'Europarlamentare 09.06.2024 / Procese Verbale'; + return '2024-06-09 / Europarlamentare / Procese Verbale'; } public function execute(): void diff --git a/app/Jobs/Europarl240609/Records/ImportAbroadRecordsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportAbroadRecordsJob.php similarity index 98% rename from app/Jobs/Europarl240609/Records/ImportAbroadRecordsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportAbroadRecordsJob.php index 201abb1..b7c1432 100644 --- a/app/Jobs/Europarl240609/Records/ImportAbroadRecordsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportAbroadRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Records; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Records; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Europarl240609/Records/ImportCountyRecordsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportCountyRecordsJob.php similarity index 98% rename from app/Jobs/Europarl240609/Records/ImportCountyRecordsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportCountyRecordsJob.php index cd80204..215ea5b 100644 --- a/app/Jobs/Europarl240609/Records/ImportCountyRecordsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Records/ImportCountyRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Records; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Records; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/Europarl240609/Turnouts/FetchTurnoutsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/FetchTurnoutsJob.php similarity index 96% rename from app/Jobs/Europarl240609/Turnouts/FetchTurnoutsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/FetchTurnoutsJob.php index b0c1da4..a1cb35c 100644 --- a/app/Jobs/Europarl240609/Turnouts/FetchTurnoutsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/FetchTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Turnouts; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Turnouts; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -19,7 +19,7 @@ class FetchTurnoutsJob extends SchedulableJob { public static function name(): string { - return 'Europarlamentare 09.06.2024 / Prezență'; + return '2024-06-09 / Europarlamentare / Prezență'; } public function execute(): void diff --git a/app/Jobs/Europarl240609/Turnouts/ImportAbroadTurnoutsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportAbroadTurnoutsJob.php similarity index 98% rename from app/Jobs/Europarl240609/Turnouts/ImportAbroadTurnoutsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportAbroadTurnoutsJob.php index 9c3886b..1705361 100644 --- a/app/Jobs/Europarl240609/Turnouts/ImportAbroadTurnoutsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportAbroadTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Turnouts; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Turnouts; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Europarl240609/Turnouts/ImportCountyTurnoutsJob.php b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportCountyTurnoutsJob.php similarity index 98% rename from app/Jobs/Europarl240609/Turnouts/ImportCountyTurnoutsJob.php rename to app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportCountyTurnoutsJob.php index 30437c5..e7569e9 100644 --- a/app/Jobs/Europarl240609/Turnouts/ImportCountyTurnoutsJob.php +++ b/app/Jobs/Y2024/M06/EuropeanParliament/Turnouts/ImportCountyTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Europarl240609\Turnouts; +namespace App\Jobs\Y2024\M06\EuropeanParliament\Turnouts; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/Presidential241124/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M11/President/Records/FetchRecordsJob.php similarity index 97% rename from app/Jobs/Presidential241124/Records/FetchRecordsJob.php rename to app/Jobs/Y2024/M11/President/Records/FetchRecordsJob.php index f10e06e..e29eec7 100644 --- a/app/Jobs/Presidential241124/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M11/President/Records/FetchRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Records; +namespace App\Jobs\Y2024\M11\President\Records; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -20,7 +20,7 @@ class FetchRecordsJob extends SchedulableJob { public static function name(): string { - return 'Prezidențiale 24.11.2024 / Procese Verbale'; + return '2024-11-24 / Prezidențiale / Procese Verbale'; } public function execute(): void diff --git a/app/Jobs/Presidential241124/Records/ImportAbroadRecordsJob.php b/app/Jobs/Y2024/M11/President/Records/ImportAbroadRecordsJob.php similarity index 98% rename from app/Jobs/Presidential241124/Records/ImportAbroadRecordsJob.php rename to app/Jobs/Y2024/M11/President/Records/ImportAbroadRecordsJob.php index 231b726..a8aaf59 100644 --- a/app/Jobs/Presidential241124/Records/ImportAbroadRecordsJob.php +++ b/app/Jobs/Y2024/M11/President/Records/ImportAbroadRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Records; +namespace App\Jobs\Y2024\M11\President\Records; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Presidential241124/Records/ImportCorrespondenceRecordsJob.php b/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php similarity index 98% rename from app/Jobs/Presidential241124/Records/ImportCorrespondenceRecordsJob.php rename to app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php index 59a30e8..f58ed06 100644 --- a/app/Jobs/Presidential241124/Records/ImportCorrespondenceRecordsJob.php +++ b/app/Jobs/Y2024/M11/President/Records/ImportCorrespondenceRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Records; +namespace App\Jobs\Y2024\M11\President\Records; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Presidential241124/Records/ImportCountyRecordsJob.php b/app/Jobs/Y2024/M11/President/Records/ImportCountyRecordsJob.php similarity index 98% rename from app/Jobs/Presidential241124/Records/ImportCountyRecordsJob.php rename to app/Jobs/Y2024/M11/President/Records/ImportCountyRecordsJob.php index 81f875f..afb0610 100644 --- a/app/Jobs/Presidential241124/Records/ImportCountyRecordsJob.php +++ b/app/Jobs/Y2024/M11/President/Records/ImportCountyRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Records; +namespace App\Jobs\Y2024\M11\President\Records; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/Parlamentare01122024/Turnouts/FetchTurnoutsJob.php b/app/Jobs/Y2024/M11/President/Turnouts/FetchTurnoutsJob.php similarity index 96% rename from app/Jobs/Parlamentare01122024/Turnouts/FetchTurnoutsJob.php rename to app/Jobs/Y2024/M11/President/Turnouts/FetchTurnoutsJob.php index 3b20df7..8661bd2 100644 --- a/app/Jobs/Parlamentare01122024/Turnouts/FetchTurnoutsJob.php +++ b/app/Jobs/Y2024/M11/President/Turnouts/FetchTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Turnouts; +namespace App\Jobs\Y2024\M11\President\Turnouts; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -19,7 +19,7 @@ class FetchTurnoutsJob extends SchedulableJob { public static function name(): string { - return 'Parlamentar 01.12.2024 / Prezență'; + return '2024-11-24 / Prezidențiale / Prezență'; } public function execute(): void diff --git a/app/Jobs/Presidential241124/Turnouts/ImportAbroadTurnoutsJob.php b/app/Jobs/Y2024/M11/President/Turnouts/ImportAbroadTurnoutsJob.php similarity index 98% rename from app/Jobs/Presidential241124/Turnouts/ImportAbroadTurnoutsJob.php rename to app/Jobs/Y2024/M11/President/Turnouts/ImportAbroadTurnoutsJob.php index 49f3c01..bedef79 100644 --- a/app/Jobs/Presidential241124/Turnouts/ImportAbroadTurnoutsJob.php +++ b/app/Jobs/Y2024/M11/President/Turnouts/ImportAbroadTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Turnouts; +namespace App\Jobs\Y2024\M11\President\Turnouts; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Presidential241124/Turnouts/ImportCountyTurnoutsJob.php b/app/Jobs/Y2024/M11/President/Turnouts/ImportCountyTurnoutsJob.php similarity index 98% rename from app/Jobs/Presidential241124/Turnouts/ImportCountyTurnoutsJob.php rename to app/Jobs/Y2024/M11/President/Turnouts/ImportCountyTurnoutsJob.php index 1c0e979..2b4b512 100644 --- a/app/Jobs/Presidential241124/Turnouts/ImportCountyTurnoutsJob.php +++ b/app/Jobs/Y2024/M11/President/Turnouts/ImportCountyTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Turnouts; +namespace App\Jobs\Y2024\M11\President\Turnouts; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/ReferendumBucuresti241124/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php similarity index 95% rename from app/Jobs/ReferendumBucuresti241124/Records/FetchRecordsJob.php rename to app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php index 308a373..9d68fe4 100644 --- a/app/Jobs/ReferendumBucuresti241124/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/FetchRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\ReferendumBucuresti241124\Records; +namespace App\Jobs\Y2024\M11\ReferendumBucuresti\Records; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -20,7 +20,7 @@ class FetchRecordsJob extends SchedulableJob { public static function name(): string { - return 'Referendum Bucuresti 24.11.2024 / Procese Verbale'; + return '2024-11-24 / Referendum București / Procese Verbale'; } public function execute(): void diff --git a/app/Jobs/ReferendumBucuresti241124/Records/ImportRecordsJob.php b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/ImportRecordsJob.php similarity index 98% rename from app/Jobs/ReferendumBucuresti241124/Records/ImportRecordsJob.php rename to app/Jobs/Y2024/M11/ReferendumBucuresti/Records/ImportRecordsJob.php index 8b326ef..e3b20b5 100644 --- a/app/Jobs/ReferendumBucuresti241124/Records/ImportRecordsJob.php +++ b/app/Jobs/Y2024/M11/ReferendumBucuresti/Records/ImportRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\ReferendumBucuresti241124\Records; +namespace App\Jobs\Y2024\M11\ReferendumBucuresti\Records; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/ReferendumBucuresti241124/Turnouts/FetchTurnoutsJob.php b/app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/FetchTurnoutsJob.php similarity index 95% rename from app/Jobs/ReferendumBucuresti241124/Turnouts/FetchTurnoutsJob.php rename to app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/FetchTurnoutsJob.php index 24854f5..364c054 100644 --- a/app/Jobs/ReferendumBucuresti241124/Turnouts/FetchTurnoutsJob.php +++ b/app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/FetchTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\ReferendumBucuresti241124\Turnouts; +namespace App\Jobs\Y2024\M11\ReferendumBucuresti\Turnouts; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -19,7 +19,7 @@ class FetchTurnoutsJob extends SchedulableJob { public static function name(): string { - return 'Referendum Bucuresti 24.11.2024 / Prezență'; + return '2024-11-24 / Referendum București / Prezență'; } public function execute(): void diff --git a/app/Jobs/ReferendumBucuresti241124/Turnouts/ImportTurnoutsJob.php b/app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/ImportTurnoutsJob.php similarity index 98% rename from app/Jobs/ReferendumBucuresti241124/Turnouts/ImportTurnoutsJob.php rename to app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/ImportTurnoutsJob.php index af023dc..0c6b721 100644 --- a/app/Jobs/ReferendumBucuresti241124/Turnouts/ImportTurnoutsJob.php +++ b/app/Jobs/Y2024/M11/ReferendumBucuresti/Turnouts/ImportTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\ReferendumBucuresti241124\Turnouts; +namespace App\Jobs\Y2024\M11\ReferendumBucuresti\Turnouts; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/Parlamentare01122024/Records/FetchRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php similarity index 97% rename from app/Jobs/Parlamentare01122024/Records/FetchRecordsJob.php rename to app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php index 2983b60..99d8823 100644 --- a/app/Jobs/Parlamentare01122024/Records/FetchRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/FetchRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Records; +namespace App\Jobs\Y2024\M12\Parliament\Records; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -20,7 +20,7 @@ class FetchRecordsJob extends SchedulableJob { public static function name(): string { - return 'Parlamentar 01.12.2024 / Procese Verbale'; + return '2024-12-01 / Parlamentare / Procese Verbale'; } public function execute(): void diff --git a/app/Jobs/Parlamentare01122024/Records/ImportAbroadRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/ImportAbroadRecordsJob.php similarity index 98% rename from app/Jobs/Parlamentare01122024/Records/ImportAbroadRecordsJob.php rename to app/Jobs/Y2024/M12/Parliament/Records/ImportAbroadRecordsJob.php index 087e13c..c9c01b0 100644 --- a/app/Jobs/Parlamentare01122024/Records/ImportAbroadRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/ImportAbroadRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Records; +namespace App\Jobs\Y2024\M12\Parliament\Records; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Parlamentare01122024/Records/ImportCorrespondenceRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/ImportCorrespondenceRecordsJob.php similarity index 96% rename from app/Jobs/Parlamentare01122024/Records/ImportCorrespondenceRecordsJob.php rename to app/Jobs/Y2024/M12/Parliament/Records/ImportCorrespondenceRecordsJob.php index a5eb40e..4cd5019 100644 --- a/app/Jobs/Parlamentare01122024/Records/ImportCorrespondenceRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/ImportCorrespondenceRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Records; +namespace App\Jobs\Y2024\M12\Parliament\Records; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; @@ -20,7 +20,7 @@ class ImportCorrespondenceRecordsJob extends SchedulableJob public static function name(): string { - return 'Parlamentare 06.12.2020/ Procese Verbale Corespondență'; + return '2024-12-01 / Parlamentare / Procese Verbale Corespondență'; } public function execute(): void diff --git a/app/Jobs/Parlamentare01122024/Records/ImportCountyRecordsJob.php b/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php similarity index 98% rename from app/Jobs/Parlamentare01122024/Records/ImportCountyRecordsJob.php rename to app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php index 3a9a0e8..23468e6 100644 --- a/app/Jobs/Parlamentare01122024/Records/ImportCountyRecordsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Records/ImportCountyRecordsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Records; +namespace App\Jobs\Y2024\M12\Parliament\Records; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Jobs/Presidential241124/Turnouts/FetchTurnoutsJob.php b/app/Jobs/Y2024/M12/Parliament/Turnouts/FetchTurnoutsJob.php similarity index 96% rename from app/Jobs/Presidential241124/Turnouts/FetchTurnoutsJob.php rename to app/Jobs/Y2024/M12/Parliament/Turnouts/FetchTurnoutsJob.php index a899794..2b93ca8 100644 --- a/app/Jobs/Presidential241124/Turnouts/FetchTurnoutsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Turnouts/FetchTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Presidential241124\Turnouts; +namespace App\Jobs\Y2024\M12\Parliament\Turnouts; use App\Jobs\DeleteTemporaryTableData; use App\Jobs\PersistTemporaryTableData; @@ -19,7 +19,7 @@ class FetchTurnoutsJob extends SchedulableJob { public static function name(): string { - return 'Prezidențiale 24.11.2024 / Prezență'; + return '2024-12-01 / Parlamentare / Prezență'; } public function execute(): void diff --git a/app/Jobs/Parlamentare01122024/Turnouts/ImportAbroadTurnoutsJob.php b/app/Jobs/Y2024/M12/Parliament/Turnouts/ImportAbroadTurnoutsJob.php similarity index 98% rename from app/Jobs/Parlamentare01122024/Turnouts/ImportAbroadTurnoutsJob.php rename to app/Jobs/Y2024/M12/Parliament/Turnouts/ImportAbroadTurnoutsJob.php index 681e476..9b857e8 100644 --- a/app/Jobs/Parlamentare01122024/Turnouts/ImportAbroadTurnoutsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Turnouts/ImportAbroadTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Turnouts; +namespace App\Jobs\Y2024\M12\Parliament\Turnouts; use App\Events\CountryCodeNotFound; use App\Exceptions\CountryCodeNotFoundException; diff --git a/app/Jobs/Parlamentare01122024/Turnouts/ImportCountyTurnoutsJob.php b/app/Jobs/Y2024/M12/Parliament/Turnouts/ImportCountyTurnoutsJob.php similarity index 98% rename from app/Jobs/Parlamentare01122024/Turnouts/ImportCountyTurnoutsJob.php rename to app/Jobs/Y2024/M12/Parliament/Turnouts/ImportCountyTurnoutsJob.php index 5f2800e..d548edc 100644 --- a/app/Jobs/Parlamentare01122024/Turnouts/ImportCountyTurnoutsJob.php +++ b/app/Jobs/Y2024/M12/Parliament/Turnouts/ImportCountyTurnoutsJob.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Jobs\Parlamentare01122024\Turnouts; +namespace App\Jobs\Y2024\M12\Parliament\Turnouts; use App\Exceptions\MissingSourceFileException; use App\Models\County; diff --git a/app/Models/ScheduledJob.php b/app/Models/ScheduledJob.php index 021413e..29596df 100644 --- a/app/Models/ScheduledJob.php +++ b/app/Models/ScheduledJob.php @@ -35,7 +35,6 @@ class ScheduledJob extends Model 'job', 'cron', 'is_enabled', - 'source_part', 'source_url', 'source_username', 'source_password', @@ -86,10 +85,6 @@ public function getPreparedSourceUrl(array $map = []): string throw new MissingSourceUrlException; } - $map = array_merge($map, [ - '{{part}}' => $this->source_part, - ]); - $search = array_keys($map); $replace = array_values($map); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 052f612..21050e0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -121,13 +121,13 @@ protected function resolveSchedule(): void ScheduledJob::query() ->with('election') ->where('is_enabled', true) - ->each( - fn (ScheduledJob $job) => $schedule + ->each(fn (ScheduledJob $job) => rescue( + fn () => $schedule ->job(new $job->job($job)) ->cron($job->cron->value) ->withoutOverlapping() ->onOneServer() - ); + )); } catch (QueryException|MissingAppKeyException $th) { // fix for composer install } diff --git a/database/migrations/2024_11_30_122918_remove_source_part_column_from_scheduled_jobs_table.php b/database/migrations/2024_11_30_122918_remove_source_part_column_from_scheduled_jobs_table.php new file mode 100644 index 0000000..289baa3 --- /dev/null +++ b/database/migrations/2024_11_30_122918_remove_source_part_column_from_scheduled_jobs_table.php @@ -0,0 +1,20 @@ +dropColumn('source_part'); + }); + } +};