mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
small fixes on sync from remote
This commit is contained in:
@@ -23,6 +23,8 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
|
||||
/**
|
||||
* Handle notification of chagnes from MSGraph
|
||||
*
|
||||
* @AsMessageHandler
|
||||
*/
|
||||
class MSGraphChangeNotificationHandler implements MessageHandlerInterface
|
||||
@@ -43,6 +45,26 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
CalendarRangeRepository $calendarRangeRepository,
|
||||
CalendarRangeSyncer $calendarRangeSyncer,
|
||||
CalendarRepository $calendarRepository,
|
||||
EntityManagerInterface $em,
|
||||
InviteRepository $inviteRepository,
|
||||
LoggerInterface $logger,
|
||||
MapCalendarToUser $mapCalendarToUser,
|
||||
UserRepository $userRepository
|
||||
) {
|
||||
$this->calendarRangeRepository = $calendarRangeRepository;
|
||||
$this->calendarRangeSyncer = $calendarRangeSyncer;
|
||||
$this->calendarRepository = $calendarRepository;
|
||||
$this->em = $em;
|
||||
$this->inviteRepository = $inviteRepository;
|
||||
$this->logger = $logger;
|
||||
$this->mapCalendarToUser = $mapCalendarToUser;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function __invoke(MSGraphChangeNotificationMessage $changeNotificationMessage): void
|
||||
{
|
||||
$user = $this->userRepository->find($changeNotificationMessage->getUserId());
|
||||
@@ -74,6 +96,8 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
|
||||
} elseif (null !== $invite = $this->inviteRepository->findOneBy(['remoteId' => $remoteId])) {
|
||||
$this->remoteToLocalSyncer->handleInviteSync($invite, $notification, $user);
|
||||
$this->em->flush();
|
||||
} else {
|
||||
$this->logger->info(__CLASS__." id not found in any calendar, calendar range nor invite");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user