2021-12-13 11:07:30 +01:00

62 lines
1.4 KiB
PHP

<?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\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
class UserApiController extends ApiController
{
/**
* @Route(
* "/api/1.0/main/user-current-location.{_format}",
* name="chill_main_user_current_location",
* requirements={
* "_format": "json"
* }
* )
*
* @param mixed $_format
*/
public function currentLocation($_format): JsonResponse
{
return $this->json(
$this->getUser()->getCurrentLocation(),
JsonResponse::HTTP_OK,
[],
['groups' => ['read']]
);
}
/**
* @Route(
* "/api/1.0/main/whoami.{_format}",
* name="chill_main_user_whoami",
* requirements={
* "_format": "json"
* }
* )
*
* @param mixed $_format
*/
public function whoami($_format): JsonResponse
{
return $this->json(
$this->getUser(),
JsonResponse::HTTP_OK,
[],
['groups' => ['read']]
);
}
}