/api/v1/me: ajout des requêtes/projets de l'utilisateur

This commit is contained in:
wpetit 2020-02-19 14:50:26 +01:00
parent a311d67f39
commit 3510e66882
1 changed files with 12 additions and 0 deletions

View File

@ -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(),
]);
}