/** * @api {get} API_DOMAIN/users User List * @apiVersion 1.0.0 * @apiName GetUser * @apiGroup User * * @apiDescription This method returns the list of all users * * @apiHeader {String} Content-Type application/json * @apiHeader {String} Authorization Bearer ACCESS_TOKEN * * @apiSuccess {Int} id The unique identification of the user * @apiSuccess {String} firstname The first name of the user * @apiSuccess {String} lastname The last name of the user * * @apiSuccessExample {json} Sample Response: * HTTP/1.1 200 OK * [ * { * "id": "12", * "firstname": "App", * "lastname": "User", * } * ] * * @param array $params * @return \Zend\Db\ResultSet\ResultSet */ public function fetchAll($params = array()) { try { $auth = $this->serviceLocator->get('library_backoffice_auth'); $requestHandler = $this->serviceLocator->get('Service\\RequestHandler'); $userManagerDao = new \DDD\Dao\User\UserManager($this->serviceLocator, 'ArrayObject'); $countryId = $auth->getIdentity()->countryId; $usersInfo = $userManagerDao->getUserByCountry($countryId); return $usersInfo; } catch (\Exception $e) { return $requestHandler->handleException($e); } }
/** * @api {get} API_DOMAIN/ginosi-link/users User List * @apiVersion 1.0.0 * @apiName GetUser * @apiGroup User * * @apiDescription This method returns the list of all users * * @apiHeader {String} Content-Type application/json * @apiHeader {String} Authorization Bearer ACCESS_TOKEN * * @apiSuccess {Int} id The unique identification of the user * @apiSuccess {String} firstname The first name of the user * @apiSuccess {String} lastname The last name of the user * @apiSuccess {String} avatar The profile picture of the user * * @apiSuccessExample {json} Sample Response: * HTTP/1.1 200 OK * [ * { * "id": "12", * "firstname": "App", * "lastname": "User", * "avatar": "https://images.ginosi.com/profile/12/1439802421_0_150.png" * } * ] * * @param array $params * @return \Zend\Db\ResultSet\ResultSet */ public function fetchAll($params = array()) { try { $auth = $this->serviceLocator->get('library_backoffice_auth'); $requestHandler = $this->serviceLocator->get('Service\\RequestHandler'); $userManagerDao = new \DDD\Dao\User\UserManager($this->serviceLocator, 'ArrayObject'); $countryId = $auth->getIdentity()->countryId; $usersInfo = $userManagerDao->getUserByCountry($countryId, ['id', 'firstname', 'lastname', 'avatar']); $usersInfoArray = []; foreach ($usersInfo as $userInfo) { $userInfo['avatar'] = 'https:' . Helper::getUserAvatar($userInfo, 'big'); $usersInfoArray[] = $userInfo; } return $usersInfoArray; } catch (\Exception $e) { return $requestHandler->handleException($e); } }