Add job for inserting members
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
69451cb8ee
commit
c463af3937
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\Initialize\Initializer;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Zoomyboy\LaravelNami\NamiException;
|
|
||||||
|
|
||||||
class NamiInitializeCommand extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'nami:initialize {--mglnr=} {--password=} {--group_id=}';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Initializes nami';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
app(Initializer::class)->run();
|
|
||||||
} catch (NamiException $e) {
|
|
||||||
$e->outputToConsole($this);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel
|
||||||
/**
|
/**
|
||||||
* The Artisan commands provided by your application.
|
* The Artisan commands provided by your application.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, class-string>
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
LetterSendAction::class,
|
LetterSendAction::class,
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Kernel extends HttpKernel
|
||||||
*
|
*
|
||||||
* These middleware are run during every request to your application.
|
* These middleware are run during every request to your application.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
\App\Http\Middleware\TrustProxies::class,
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
@ -25,7 +25,7 @@ class Kernel extends HttpKernel
|
||||||
/**
|
/**
|
||||||
* The application's route middleware groups.
|
* The application's route middleware groups.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<string, array<int, string>>
|
||||||
*/
|
*/
|
||||||
protected $middlewareGroups = [
|
protected $middlewareGroups = [
|
||||||
'web' => [
|
'web' => [
|
||||||
|
@ -51,7 +51,7 @@ class Kernel extends HttpKernel
|
||||||
*
|
*
|
||||||
* These middleware may be assigned to groups or used individually.
|
* These middleware may be assigned to groups or used individually.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [
|
protected $routeMiddleware = [
|
||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CheckForMaintenanceMode extends Middleware
|
||||||
/**
|
/**
|
||||||
* The URIs that should be reachable while maintenance mode is enabled.
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
];
|
];
|
||||||
|
|
|
@ -9,7 +9,7 @@ class EncryptCookies extends Middleware
|
||||||
/**
|
/**
|
||||||
* The names of the cookies that should not be encrypted.
|
* The names of the cookies that should not be encrypted.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
];
|
];
|
||||||
|
|
|
@ -8,6 +8,9 @@ use Closure;
|
||||||
|
|
||||||
class RedirectIfNotInitializedMiddleware
|
class RedirectIfNotInitializedMiddleware
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
public array $dontRedirect = ['initialize.form', 'initialize.store'];
|
public array $dontRedirect = ['initialize.form', 'initialize.store'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TrimStrings extends Middleware
|
||||||
/**
|
/**
|
||||||
* The names of the attributes that should not be trimmed.
|
* The names of the attributes that should not be trimmed.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
'password',
|
'password',
|
||||||
|
|
|
@ -10,7 +10,7 @@ class TrustProxies extends Middleware
|
||||||
/**
|
/**
|
||||||
* The trusted proxies for this application.
|
* The trusted proxies for this application.
|
||||||
*
|
*
|
||||||
* @var array|string
|
* @var array<int, string>|string|null
|
||||||
*/
|
*/
|
||||||
protected $proxies;
|
protected $proxies;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class VerifyCsrfToken extends Middleware
|
||||||
/**
|
/**
|
||||||
* The URIs that should be excluded from CSRF verification.
|
* The URIs that should be excluded from CSRF verification.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
namespace App\Http\Resources;
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin \App\User
|
* @mixin User
|
||||||
*/
|
*/
|
||||||
class UserResource extends JsonResource
|
class UserResource extends JsonResource
|
||||||
{
|
{
|
||||||
|
@ -15,9 +16,9 @@ class UserResource extends JsonResource
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
|
|
|
@ -2,13 +2,23 @@
|
||||||
|
|
||||||
namespace App\Initialize\Actions;
|
namespace App\Initialize\Actions;
|
||||||
|
|
||||||
use App\Initialize\InitializeJob;
|
use App\Initialize\InitializeActivities;
|
||||||
|
use App\Initialize\InitializeConfessions;
|
||||||
|
use App\Initialize\InitializeCountries;
|
||||||
|
use App\Initialize\InitializeCourses;
|
||||||
|
use App\Initialize\InitializeFees;
|
||||||
|
use App\Initialize\InitializeGenders;
|
||||||
|
use App\Initialize\InitializeGroups;
|
||||||
|
use App\Initialize\InitializeMembers;
|
||||||
|
use App\Initialize\InitializeNationalities;
|
||||||
|
use App\Initialize\InitializeRegions;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Lorisleiva\Actions\ActionRequest;
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Zoomyboy\LaravelNami\Api;
|
||||||
use Zoomyboy\LaravelNami\Nami;
|
use Zoomyboy\LaravelNami\Nami;
|
||||||
|
|
||||||
class InitializeAction
|
class InitializeAction
|
||||||
|
@ -17,9 +27,29 @@ class InitializeAction
|
||||||
|
|
||||||
public string $commandSignature = 'initialize {--mglnr=} {--password=} {--group=}';
|
public string $commandSignature = 'initialize {--mglnr=} {--password=} {--group=}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<int, class-string>
|
||||||
|
*/
|
||||||
|
public array $initializers = [
|
||||||
|
InitializeGroups::class,
|
||||||
|
InitializeNationalities::class,
|
||||||
|
InitializeFees::class,
|
||||||
|
InitializeActivities::class,
|
||||||
|
InitializeConfessions::class,
|
||||||
|
InitializeCountries::class,
|
||||||
|
InitializeGenders::class,
|
||||||
|
InitializeRegions::class,
|
||||||
|
InitializeCourses::class,
|
||||||
|
InitializeMembers::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
private Api $api;
|
||||||
|
|
||||||
public function handle(int $mglnr, string $password, int $groupId): void
|
public function handle(int $mglnr, string $password, int $groupId): void
|
||||||
{
|
{
|
||||||
InitializeJob::dispatch();
|
foreach ($this->initializers as $initializer) {
|
||||||
|
app($initializer)->handle($this->api);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +76,9 @@ class InitializeAction
|
||||||
|
|
||||||
public function asController(ActionRequest $request, NamiSettings $settings): RedirectResponse
|
public function asController(ActionRequest $request, NamiSettings $settings): RedirectResponse
|
||||||
{
|
{
|
||||||
$api = Nami::login($request->input('mglnr'), $request->input('password'));
|
$this->api = Nami::login($request->input('mglnr'), $request->input('password'));
|
||||||
|
|
||||||
if (!$api->hasGroup($request->input('group_id'))) {
|
if (!$this->api->hasGroup($request->input('group_id'))) {
|
||||||
throw ValidationException::withMessages(['nami' => 'Gruppierung nicht gefunden.']);
|
throw ValidationException::withMessages(['nami' => 'Gruppierung nicht gefunden.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +101,7 @@ class InitializeAction
|
||||||
$mglnr = (int) $command->option('mglnr');
|
$mglnr = (int) $command->option('mglnr');
|
||||||
$password = $command->option('password');
|
$password = $command->option('password');
|
||||||
$group = (int) $command->option('group');
|
$group = (int) $command->option('group');
|
||||||
$api = Nami::login($mglnr, $password);
|
$this->api = Nami::login($mglnr, $password);
|
||||||
$settings->mglnr = $mglnr;
|
$settings->mglnr = $mglnr;
|
||||||
$settings->password = $password;
|
$settings->password = $password;
|
||||||
$settings->default_group_id = $group;
|
$settings->default_group_id = $group;
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Initialize\Actions;
|
||||||
|
|
||||||
|
use App\Actions\InsertCoursesAction;
|
||||||
|
use App\Actions\InsertMemberAction;
|
||||||
|
use App\Actions\InsertMembershipsAction;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Zoomyboy\LaravelNami\Data\Course as NamiCourse;
|
||||||
|
use Zoomyboy\LaravelNami\Data\Member as NamiMember;
|
||||||
|
use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry;
|
||||||
|
|
||||||
|
class ProcessRedisAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public string $jobQueue = 'single';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{member: array<string, mixed>, memberships: array<string, mixed>, courses: array<string, mixed>} $data
|
||||||
|
*/
|
||||||
|
public function handle(array $data): void
|
||||||
|
{
|
||||||
|
$localMember = InsertMemberAction::run(NamiMember::from($data['member']));
|
||||||
|
InsertMembershipsAction::run(
|
||||||
|
$localMember,
|
||||||
|
collect($data['memberships'])->map(fn ($membership) => NamiMembershipEntry::from($membership)),
|
||||||
|
);
|
||||||
|
InsertCoursesAction::run(
|
||||||
|
$localMember,
|
||||||
|
collect($data['courses'])->map(fn ($course) => NamiCourse::from($course)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Initialize;
|
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class InitializeJob implements ShouldQueue
|
|
||||||
{
|
|
||||||
use Dispatchable;
|
|
||||||
use InteractsWithQueue;
|
|
||||||
use Queueable;
|
|
||||||
use SerializesModels;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->onQueue('long');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the job.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
app(Initializer::class)->run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function failed(Throwable $e): void
|
|
||||||
{
|
|
||||||
app(Initializer::class)->restore();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Initialize;
|
|
||||||
|
|
||||||
use App\Actions\InsertMemberAction;
|
|
||||||
use App\Actions\PullCoursesAction;
|
|
||||||
use App\Actions\PullMembershipsAction;
|
|
||||||
use App\Nami\Api\MemberAction;
|
|
||||||
use App\Setting\NamiSettings;
|
|
||||||
use DB;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
|
||||||
use Zoomyboy\LaravelNami\Api;
|
|
||||||
use Zoomyboy\LaravelNami\Data\MemberEntry as NamiMember;
|
|
||||||
use Zoomyboy\LaravelNami\Exceptions\Skippable;
|
|
||||||
|
|
||||||
class InitializeMember
|
|
||||||
{
|
|
||||||
use AsAction;
|
|
||||||
|
|
||||||
public function handle(Api $api): void
|
|
||||||
{
|
|
||||||
$allMembers = collect([]);
|
|
||||||
|
|
||||||
$jobs = $api->search([])->map(function (NamiMember $member) use ($api) {
|
|
||||||
return MemberAction::makeJob($api, $member->groupId, $member->id);
|
|
||||||
})->toArray();
|
|
||||||
|
|
||||||
$batch = Bus::batch($jobs)
|
|
||||||
// ->then(function (Batch $batch) {
|
|
||||||
// $localMember = InsertMemberAction::run();
|
|
||||||
// })->catch(function (Batch $batch, Throwable $e) {
|
|
||||||
// // First batch job failure detected...
|
|
||||||
// })->finally(function (Batch $batch) {
|
|
||||||
// // The batch has finished executing...
|
|
||||||
// })
|
|
||||||
->dispatch();
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
} catch (Skippable $e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// app(PullMembershipsAction::class)->handle($localMember);
|
|
||||||
// app(PullCoursesAction::class)->handle($localMember);
|
|
||||||
});
|
|
||||||
|
|
||||||
$batch = Bus::batch([
|
|
||||||
new ImportCsv(1, 100),
|
|
||||||
new ImportCsv(101, 200),
|
|
||||||
new ImportCsv(201, 300),
|
|
||||||
new ImportCsv(301, 400),
|
|
||||||
new ImportCsv(401, 500),
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Actions\InsertCoursesAction;
|
use App\Initialize\Actions\ProcessRedisAction;
|
||||||
use App\Actions\InsertMemberAction;
|
|
||||||
use App\Actions\InsertMembershipsAction;
|
|
||||||
use App\Nami\Api\CompleteMemberToRedisJob;
|
use App\Nami\Api\CompleteMemberToRedisJob;
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use DB;
|
use DB;
|
||||||
|
@ -12,12 +10,10 @@ use Illuminate\Bus\Batch;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Bus;
|
use Illuminate\Support\Facades\Bus;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
use Log;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
use Zoomyboy\LaravelNami\Data\Course as NamiCourse;
|
|
||||||
use Zoomyboy\LaravelNami\Data\Member as NamiMember;
|
|
||||||
use Zoomyboy\LaravelNami\Data\MemberEntry as NamiMemberEntry;
|
use Zoomyboy\LaravelNami\Data\MemberEntry as NamiMemberEntry;
|
||||||
use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry;
|
|
||||||
|
|
||||||
class InitializeMembers
|
class InitializeMembers
|
||||||
{
|
{
|
||||||
|
@ -37,24 +33,13 @@ class InitializeMembers
|
||||||
|
|
||||||
$batch = Bus::batch($jobs)
|
$batch = Bus::batch($jobs)
|
||||||
->finally(function (Batch $batch) {
|
->finally(function (Batch $batch) {
|
||||||
|
Log::debug('Complete Member count: '.count(Redis::lrange('members', 0, -1)));
|
||||||
foreach (Redis::lrange('members', 0, -1) as $data) {
|
foreach (Redis::lrange('members', 0, -1) as $data) {
|
||||||
try {
|
ProcessRedisAction::dispatch(json_decode($data, true));
|
||||||
$data = json_decode($data, true);
|
|
||||||
$localMember = InsertMemberAction::run(NamiMember::from($data['member']));
|
|
||||||
InsertMembershipsAction::run(
|
|
||||||
$localMember,
|
|
||||||
collect($data['memberships'])->map(fn ($membership) => NamiMembershipEntry::from($membership)),
|
|
||||||
);
|
|
||||||
InsertCoursesAction::run(
|
|
||||||
$localMember,
|
|
||||||
collect($data['courses'])->map(fn ($course) => NamiCourse::from($course)),
|
|
||||||
);
|
|
||||||
} catch (Skippable $e) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->onQueue('long')
|
->onQueue('long')
|
||||||
|
->allowFailures()
|
||||||
->dispatch();
|
->dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Initialize;
|
|
||||||
|
|
||||||
use App\Setting\NamiSettings;
|
|
||||||
|
|
||||||
class Initializer
|
|
||||||
{
|
|
||||||
public NamiSettings $settings;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array<int, class-string>
|
|
||||||
*/
|
|
||||||
public array $initializers = [
|
|
||||||
InitializeGroups::class,
|
|
||||||
InitializeNationalities::class,
|
|
||||||
InitializeFees::class,
|
|
||||||
InitializeActivities::class,
|
|
||||||
InitializeConfessions::class,
|
|
||||||
InitializeCountries::class,
|
|
||||||
InitializeGenders::class,
|
|
||||||
InitializeRegions::class,
|
|
||||||
InitializeCourses::class,
|
|
||||||
InitializeMembers::class,
|
|
||||||
];
|
|
||||||
|
|
||||||
public function __construct(NamiSettings $settings)
|
|
||||||
{
|
|
||||||
$this->settings = $settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
foreach ($this->initializers as $initializer) {
|
|
||||||
app($initializer)->handle($this->settings->login());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function restore(): void
|
|
||||||
{
|
|
||||||
foreach (array_reverse($this->initializers) as $initializer) {
|
|
||||||
app($initializer)->restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
$settings = app(NamiSettings::class);
|
|
||||||
$settings->mglnr = 0;
|
|
||||||
$settings->password = '';
|
|
||||||
$settings->default_group_id = 0;
|
|
||||||
$settings->save();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,6 +9,7 @@ use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
use Log;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class CompleteMemberToRedisJob implements ShouldQueue
|
class CompleteMemberToRedisJob implements ShouldQueue
|
||||||
|
@ -29,6 +30,8 @@ class CompleteMemberToRedisJob implements ShouldQueue
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
if ($this->batch()->cancelled()) {
|
if ($this->batch()->cancelled()) {
|
||||||
|
Log::debug('Cancelling batch');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class EventServiceProvider extends ServiceProvider
|
||||||
/**
|
/**
|
||||||
* The event listener mappings for the application.
|
* The event listener mappings for the application.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array<string, array<int, string>>
|
||||||
*/
|
*/
|
||||||
protected $listen = [
|
protected $listen = [
|
||||||
Registered::class => [
|
Registered::class => [
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
"inertiajs/inertia-laravel": "^0.5.4",
|
"inertiajs/inertia-laravel": "^0.5.4",
|
||||||
"laravel/framework": "^9.0",
|
"laravel/framework": "^9.0",
|
||||||
"laravel/horizon": "^5.0",
|
"laravel/horizon": "^5.0",
|
||||||
"laravel/telescope": "^4.0",
|
"laravel/telescope": "^4.13",
|
||||||
"laravel/tinker": "^2.0",
|
"laravel/tinker": "^2.0",
|
||||||
"laravel/ui": "^3.0",
|
"laravel/ui": "^3.0",
|
||||||
"lorisleiva/laravel-actions": "^2.4",
|
"lorisleiva/laravel-actions": "^2.4",
|
||||||
"monicahq/laravel-sabre": "^1.6",
|
"monicahq/laravel-sabre": "^1.6",
|
||||||
"nunomaduro/collision": "^6.1",
|
"nunomaduro/collision": "^6.1",
|
||||||
"phake/phake": "^4.2",
|
"phake/phake": "^4.2",
|
||||||
"spatie/laravel-data": "^2.0",
|
"spatie/laravel-data": "^3.0",
|
||||||
"spatie/laravel-ignition": "^1.0",
|
"spatie/laravel-ignition": "^1.0",
|
||||||
"spatie/laravel-medialibrary": "^10.0",
|
"spatie/laravel-medialibrary": "^10.0",
|
||||||
"spatie/laravel-settings": "^2.2",
|
"spatie/laravel-settings": "^2.2",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -165,6 +165,13 @@ return [
|
||||||
|
|
||||||
'environments' => [
|
'environments' => [
|
||||||
'production' => [
|
'production' => [
|
||||||
|
'supervisor-single' => [
|
||||||
|
'connection' => 'redis',
|
||||||
|
'queue' => ['single'],
|
||||||
|
'balance' => 'simple',
|
||||||
|
'processes' => 1,
|
||||||
|
'tries' => 1,
|
||||||
|
],
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['default'],
|
'queue' => ['default'],
|
||||||
|
@ -183,6 +190,13 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'local' => [
|
'local' => [
|
||||||
|
'supervisor-single' => [
|
||||||
|
'connection' => 'redis',
|
||||||
|
'queue' => ['single'],
|
||||||
|
'balance' => 'simple',
|
||||||
|
'processes' => 1,
|
||||||
|
'tries' => 1,
|
||||||
|
],
|
||||||
'supervisor-1' => [
|
'supervisor-1' => [
|
||||||
'connection' => 'redis',
|
'connection' => 'redis',
|
||||||
'queue' => ['default'],
|
'queue' => ['default'],
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 927bf7a09ce5d1f3cef14e60060c7f885ef140d6
|
Subproject commit d48383ded42851e9f7231b49142ac31c12b8238b
|
64
phpstan.neon
64
phpstan.neon
|
@ -25,11 +25,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: app/Activity.php
|
path: app/Activity.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Console\\\\Kernel\\:\\:\\$commands type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Console/Kernel.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Unable to resolve the template type TKey in call to function collect$#"
|
message: "#^Unable to resolve the template type TKey in call to function collect$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -115,56 +110,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: app/Http/Controllers/Auth/RegisterController.php
|
path: app/Http/Controllers/Auth/RegisterController.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Kernel\\:\\:\\$middleware type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Kernel.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Kernel\\:\\:\\$middlewareGroups type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Kernel.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Kernel\\:\\:\\$routeMiddleware type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Kernel.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\CheckForMaintenanceMode\\:\\:\\$except type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/CheckForMaintenanceMode.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\EncryptCookies\\:\\:\\$except type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/EncryptCookies.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\RedirectIfNotInitializedMiddleware\\:\\:\\$dontRedirect type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/RedirectIfNotInitializedMiddleware.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\TrimStrings\\:\\:\\$except type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/TrimStrings.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\TrustProxies\\:\\:\\$proxies type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/TrustProxies.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Http\\\\Middleware\\\\VerifyCsrfToken\\:\\:\\$except type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Middleware/VerifyCsrfToken.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method App\\\\Http\\\\Resources\\\\UserResource\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Http/Resources/UserResource.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method App\\\\Http\\\\Views\\\\MemberView\\:\\:index\\(\\) has parameter \\$filter with no value type specified in iterable type array\\.$#"
|
message: "#^Method App\\\\Http\\\\Views\\\\MemberView\\:\\:index\\(\\) has parameter \\$filter with no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -250,11 +195,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: app/Providers/AuthServiceProvider.php
|
path: app/Providers/AuthServiceProvider.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Property App\\\\Providers\\\\EventServiceProvider\\:\\:\\$listen type has no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Providers/EventServiceProvider.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Property App\\\\Region\\:\\:\\$casts type has no value type specified in iterable type array\\.$#"
|
message: "#^Property App\\\\Region\\:\\:\\$casts type has no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -793,10 +733,6 @@ parameters:
|
||||||
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\TestCase\\:\\:getAnnotations\\(\\) return type has no value type specified in iterable type array\\.$#"
|
message: "#^Method Zoomyboy\\\\LaravelNami\\\\Tests\\\\TestCase\\:\\:getAnnotations\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: packages/laravel-nami/tests/TestCase.php
|
path: packages/laravel-nami/tests/TestCase.php
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Support\\\\LazyCollection\\<int,Zoomyboy\\\\LaravelNami\\\\Data\\\\MemberEntry\\>\\:\\:each\\(\\) expects callable\\(int, int\\)\\: mixed, Closure\\(Zoomyboy\\\\LaravelNami\\\\Data\\\\MemberEntry\\)\\: void given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: app/Initialize/InitializeMembers.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Mockery\\\\ExpectationInterface\\|Mockery\\\\HigherOrderMessage\\:\\:never\\(\\)\\.$#"
|
message: "#^Call to an undefined method Mockery\\\\ExpectationInterface\\|Mockery\\\\HigherOrderMessage\\:\\:never\\(\\)\\.$#"
|
||||||
|
|
|
@ -3,10 +3,8 @@
|
||||||
namespace Tests\Feature\Initialize;
|
namespace Tests\Feature\Initialize;
|
||||||
|
|
||||||
use App\Initialize\Actions\InitializeAction;
|
use App\Initialize\Actions\InitializeAction;
|
||||||
use App\Initialize\InitializeJob;
|
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\Queue;
|
|
||||||
use Tests\RequestFactories\InitializeRequestFactory;
|
use Tests\RequestFactories\InitializeRequestFactory;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Zoomyboy\LaravelNami\Authentication\Auth;
|
use Zoomyboy\LaravelNami\Authentication\Auth;
|
||||||
|
@ -73,16 +71,6 @@ class InitializeActionTest extends TestCase
|
||||||
$this->assertErrors(['nami' => 'Gruppierung nicht gefunden.'], $response);
|
$this->assertErrors(['nami' => 'Gruppierung nicht gefunden.'], $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItFiresJobWhenRunningInitializer(): void
|
|
||||||
{
|
|
||||||
Queue::fake();
|
|
||||||
$this->withoutExceptionHandling()->login();
|
|
||||||
|
|
||||||
app(InitializeAction::class)->handle(12345, 'secret', 185);
|
|
||||||
|
|
||||||
Queue::assertPushed(InitializeJob::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function factory(): InitializeRequestFactory
|
private function factory(): InitializeRequestFactory
|
||||||
{
|
{
|
||||||
return InitializeRequestFactory::new();
|
return InitializeRequestFactory::new();
|
||||||
|
|
Loading…
Reference in New Issue