mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
[wip] first impl for getting authorization for admin
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\CalendarBundle\Controller;
|
||||
|
||||
use Chill\CalendarBundle\Synchro\Connector\RemoteCalendarConnectorInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* Contains method to get events (Calendar) from remote calendar.
|
||||
*/
|
||||
class RemoteCalendarProxyController
|
||||
{
|
||||
private RemoteCalendarConnectorInterface $remoteCalendarConnector;
|
||||
|
||||
public function listEventForCalendar(User $user, Request $request): Response
|
||||
{
|
||||
if ($request->query->has('startDate')) {
|
||||
$startDate = DateTimeImmutable::createFromFormat('Y-m-dTHis', $request->query->get('startDate') . '000000');
|
||||
} else {
|
||||
throw new BadRequestHttpException('startDate not provided');
|
||||
}
|
||||
|
||||
if ($request->query->has('endDate')) {
|
||||
$startDate = DateTimeImmutable::createFromFormat('Y-m-dTHis', $request->query->get('endDate') . '000000');
|
||||
} else {
|
||||
throw new BadRequestHttpException('endDate not provided');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user