Remove deleted members on pull
This commit is contained in:
parent
bf33a91e7e
commit
7877f57a22
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue