Remove deleted members on pull
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is failing Details

This commit is contained in:
Philipp Lang 2023-07-06 14:29:35 +02:00
parent bf33a91e7e
commit 7877f57a22
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace App\Initialize;
use App\Member\Actions\InsertFullMemberAction;
use App\Member\Data\FullMember;
use App\Member\Member;
use App\Nami\Api\FullMemberAction;
use App\Setting\NamiSettings;
use Illuminate\Support\Facades\Bus;
@ -24,6 +25,9 @@ class InitializeMembers
$settings = app(NamiSettings::class);
Redis::delete('members');
$memberIds = $api->search($settings->search_params)->map(fn ($member) => $member->id)->toArray();
Member::remote()->whereNotIn('nami_id', $memberIds)->get()->each->delete();
$jobs = $api->search($settings->search_params)->map(function (NamiMemberEntry $member) use ($api) {
return FullMemberAction::makeJob($api, $member->groupId, $member->id, 'members');
})->toArray();