Files
CRM/app/Services/DavClient/Utils/AddressBookContactsUpdaterMissed.php
Kroonk a213a1dba0
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
refactor: replace custom CRM with Monica fork
2026-05-22 16:19:55 +02:00

36 lines
1.1 KiB
PHP

<?php
namespace App\Services\DavClient\Utils;
use Illuminate\Support\Collection;
use App\Services\DavClient\Utils\Model\SyncDto;
use App\Services\DavClient\Utils\Model\ContactDto;
use App\Services\DavClient\Utils\Traits\WithSyncDto;
class AddressBookContactsUpdaterMissed
{
use WithSyncDto;
/**
* Update local missed contacts.
*
* @param SyncDto $sync
* @param Collection<array-key, \App\Models\Contact\Contact> $localContacts
* @param Collection<array-key, \App\Services\DavClient\Utils\Model\ContactDto> $distContacts
* @return Collection
*/
public function execute(SyncDto $sync, Collection $localContacts, Collection $distContacts): Collection
{
$this->sync = $sync;
$uuids = $localContacts->pluck('uuid');
$missed = $distContacts->reject(function (ContactDto $contact) use ($uuids): bool {
return $uuids->contains($this->backend()->getUuid($contact->uri));
});
return app(AddressBookContactsUpdater::class)
->execute($this->sync, $missed);
}
}