Commit a85cc509f989801ef315420920369bf5d897872a
1 parent
3412fb9f
registration
Showing
2 changed files
with
20 additions
and
14 deletions
Show diff stats
app/library/App/Controllers/UserController.php
| @@ -8,6 +8,15 @@ use PhalconRest\Mvc\Controllers\CrudResourceController; | @@ -8,6 +8,15 @@ use PhalconRest\Mvc\Controllers\CrudResourceController; | ||
| 8 | 8 | ||
| 9 | class UserController extends CrudResourceController | 9 | class UserController extends CrudResourceController |
| 10 | { | 10 | { |
| 11 | + public function whitelist() | ||
| 12 | + { | ||
| 13 | + return [ | ||
| 14 | + 'username', | ||
| 15 | + 'password', | ||
| 16 | + 'email' | ||
| 17 | + ]; | ||
| 18 | + } | ||
| 19 | + | ||
| 11 | public function me() | 20 | public function me() |
| 12 | { | 21 | { |
| 13 | return $this->createResourceResponse($this->userService->getDetails()); | 22 | return $this->createResourceResponse($this->userService->getDetails()); |
| @@ -78,20 +87,6 @@ class UserController extends CrudResourceController | @@ -78,20 +87,6 @@ class UserController extends CrudResourceController | ||
| 78 | 87 | ||
| 79 | } | 88 | } |
| 80 | 89 | ||
| 81 | - public function whitelist() | ||
| 82 | - { | ||
| 83 | - return [ | ||
| 84 | - 'username', | ||
| 85 | - 'password', | ||
| 86 | - 'email' | ||
| 87 | - ]; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | -// protected function getModelPrimaryKey() | ||
| 91 | -// { | ||
| 92 | -// return 'id'; | ||
| 93 | -// } | ||
| 94 | - | ||
| 95 | protected function transformPostDataValue($key, $value, $data) | 90 | protected function transformPostDataValue($key, $value, $data) |
| 96 | { | 91 | { |
| 97 | if ($key == 'password') { | 92 | if ($key == 'password') { |
app/library/App/Resources/UserResource.php
| @@ -45,6 +45,17 @@ class UserResource extends ApiResource { | @@ -45,6 +45,17 @@ class UserResource extends ApiResource { | ||
| 45 | ->deny(AclRoles::AUTHORIZED) | 45 | ->deny(AclRoles::AUTHORIZED) |
| 46 | ->description('Register new user') | 46 | ->description('Register new user') |
| 47 | ->expectsJsonData() | 47 | ->expectsJsonData() |
| 48 | + ->exampleResponse([ | ||
| 49 | + "result" => "OK", | ||
| 50 | + "user" => [ | ||
| 51 | + "id" => "95", | ||
| 52 | + "username" => "MyLogin", | ||
| 53 | + "email" => "myGmail@gmail.com", | ||
| 54 | + "role" => "User", | ||
| 55 | + "createdAt" => "2017-02-16 17:57:52", | ||
| 56 | + "updatedAt" => "2017-02-16 17:57:52" | ||
| 57 | + ] | ||
| 58 | + ]) | ||
| 48 | ); | 59 | ); |
| 49 | } | 60 | } |
| 50 | } | 61 | } |
| 51 | \ No newline at end of file | 62 | \ No newline at end of file |