mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
add the current location of the user as API point + add it in the activity location list
This commit is contained in:
@@ -37,4 +37,25 @@ class UserApiController extends ApiController
|
||||
['groups' => ['read']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -61,6 +61,14 @@ final class UserApiControllerTest extends WebTestCase
|
||||
|
||||
$client->request(Request::METHOD_GET, '/api/1.0/main/whoami.json');
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
public function testUserCurrentLocation()
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
$client->request(Request::METHOD_GET, '/api/1.0/main/user-current-location.json');
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
}
|
||||
}
|
||||
|
@@ -546,6 +546,14 @@ paths:
|
||||
responses:
|
||||
200:
|
||||
description: "ok"
|
||||
/1.0/main/user-current-location.json:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Return the current location of the currently authenticated user
|
||||
responses:
|
||||
200:
|
||||
description: "ok"
|
||||
/1.0/main/user/{id}.json:
|
||||
get:
|
||||
tags:
|
||||
|
Reference in New Issue
Block a user