From 54a751820f39e8891f775b8d9293349399b3e8c2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 22 May 2017 15:33:16 -0400 Subject: Add task and project API formatters --- app/Api/Procedure/ProjectProcedure.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app/Api/Procedure/ProjectProcedure.php') diff --git a/app/Api/Procedure/ProjectProcedure.php b/app/Api/Procedure/ProjectProcedure.php index e8a34cd3..c9ac0ae6 100644 --- a/app/Api/Procedure/ProjectProcedure.php +++ b/app/Api/Procedure/ProjectProcedure.php @@ -15,33 +15,34 @@ class ProjectProcedure extends BaseProcedure public function getProjectById($project_id) { ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectById', $project_id); - return $this->formatProject($this->projectModel->getById($project_id)); + $project = $this->projectModel->getById($project_id); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByName($name) { $project = $this->projectModel->getByName($name); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByName', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByIdentifier($identifier) { - $project = $this->formatProject($this->projectModel->getByIdentifier($identifier)); + $project = $this->projectModel->getByIdentifier($identifier); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByIdentifier', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getProjectByEmail($email) { - $project = $this->formatProject($this->projectModel->getByEmail($email)); + $project = $this->projectModel->getByEmail($email); ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByEmail', $project['id']); - return $this->formatProject($project); + return $this->projectApiFormatter->withProject($project)->format(); } public function getAllProjects() { - return $this->formatProjects($this->projectModel->getAll()); + return $this->projectsApiFormatter->withProjects($this->projectModel->getAll())->format(); } public function removeProject($project_id) -- cgit v1.2.3