Commit 1ad141d1 authored by philippepary's avatar philippepary
Browse files

Added user route

parent b18ac95b
......@@ -11,6 +11,7 @@ $files = [
"../src/http/routes/category.php",
"../src/http/routes/currency.php",
"../src/http/routes/product.php",
"../src/http/routes/user.php",
];
$dirs = [
"../src/http/routes/",
......
......@@ -4,11 +4,12 @@ use \Pasteque\Server\System\API\APICaller;
use \Pasteque\Server\System\API\APIResult;
/**
* GET userGetAllGet
* Summary:
* Notes: Get a array of all User
* Output-Formats: [application/json]
* @rest\endpoint /user/getAll
* @rest\method GET Get all users
* @rest\response 200 array(User) An array of users
* @rest\tags users
*/
//
$app->GET('/api/user/getAll', function ($request, $response, $args) {
$ptApp = $this->get('settings')['ptApp'];
return $response->withApiResult(APICaller::run($ptApp, 'user', 'getAll'));
......@@ -16,11 +17,13 @@ $app->GET('/api/user/getAll', function ($request, $response, $args) {
/**
* GET userIdGet
* Summary:
* Notes: Get a User
* Output-Formats: [application/json]
* @rest\endpoint /user/{id}
* @rest\method GET Get an user by its ID
* @rest\path Int id ID of the user
* @rest\response 200 User The user
* @rest\tags users
*/
//
$app->GET('/api/user/{id}', function ($request, $response, $args) {
$ptApp = $this->get('settings')['ptApp'];
return $response->withApiResult(APICaller::run($ptApp, 'user', 'get', $args['id']));
......@@ -28,10 +31,12 @@ $app->GET('/api/user/{id}', function ($request, $response, $args) {
/**
* POST userPasswordPut
* Summary:
* Notes: update password of an user
* Output-Formats: [application/json]
* @rest\endpoint /user/{id}/password
* @rest\method POST Update an user's password
* @rest\path Int id ID of the user
* @rest\response 200 User The updated user
* @rest\response 404
* @rest\tags users
*/
$app->POST('/api/user/{id}/password', function ($request, $response, $args) {
$ptApp = $this->get('settings')['ptApp'];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment