From 3510e66882ae88701af04002cae6a6200262c123 Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 19 Feb 2020 14:50:26 +0100 Subject: [PATCH] =?UTF-8?q?/api/v1/me:=20ajout=20des=20requ=C3=AAtes/proje?= =?UTF-8?q?ts=20de=20l'utilisateur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/Controller/UserController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/src/Controller/UserController.php b/backend/src/Controller/UserController.php index 67c8e7d..2c0519a 100644 --- a/backend/src/Controller/UserController.php +++ b/backend/src/Controller/UserController.php @@ -22,6 +22,18 @@ class UserController extends Controller return new DataResponse([ 'username' => $user->getUsername(), 'roles' => $user->getRoles(), + 'projects' => $user->getProjects()->map(function($project) { + return [ + 'id' => $project->getId(), + 'name' => $project->getName(), + ]; + })->toArray(), + 'requests' => $user->getRequests()->map(function($request) { + return [ + 'id' => $request->getId(), + 'title' => $request->getTitle(), + ]; + })->toArray(), ]); }