1 | <?php |
||
21 | class UserController extends FOSRestController implements ControllerInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var \App\Users\Service\RegisterService |
||
25 | */ |
||
26 | private $registerService; |
||
27 | |||
28 | private $translator; |
||
29 | |||
30 | 8 | public function __construct(RegisterService $registerService, TranslatorInterface $translator) |
|
35 | |||
36 | /** |
||
37 | * Registration |
||
38 | * |
||
39 | * @Route("/api/users", methods={"POST"}) |
||
40 | * @SWG\Parameter(name="registration.username", in="formData", type="string") |
||
41 | * @SWG\Parameter(name="registration.password", in="formData", type="string") |
||
42 | * @SWG\Parameter(name="registration.email", in="formData", type="string") |
||
43 | * @SWG\Response( |
||
44 | * description="Registration.", |
||
45 | * response=202, |
||
46 | * @Model(type=User::class) |
||
47 | * ) |
||
48 | * @param $request \App\Users\Request\RegisterUserRequest |
||
49 | * @return User |
||
50 | */ |
||
51 | 2 | public function postUsers(RegisterUserRequest $request) |
|
57 | |||
58 | /** |
||
59 | * Confirm email |
||
60 | * |
||
61 | * @Route("/api/confirmEmail", methods={"POST"}) |
||
62 | * @SWG\Parameter(name="token", in="formData", type="string") |
||
63 | * @SWG\Response( |
||
64 | * description="Email confirmed.", |
||
65 | * response=202 |
||
66 | * ) |
||
67 | * @param $request ConfirmEmailRequest |
||
68 | * @param $confirmationTokenRepository \App\Users\Repository\ConfirmationTokenRepository |
||
69 | * @return JsonResponse |
||
70 | */ |
||
71 | 2 | public function postConfirmEmail(ConfirmEmailRequest $request, ConfirmationTokenRepository $confirmationTokenRepository) |
|
91 | |||
92 | /** |
||
93 | * Get single user |
||
94 | * |
||
95 | * @Route("/api/users/{id}", methods={"GET"}) |
||
96 | * @SWG\Response( |
||
97 | * description="REST action which returns user by id.", |
||
98 | * response=200, |
||
99 | * @Model(type=User::class) |
||
100 | * ) |
||
101 | * |
||
102 | * @param int $id |
||
103 | * @return User |
||
104 | */ |
||
105 | public function getUsers($id) |
||
123 | |||
124 | /** |
||
125 | * Get all users |
||
126 | * |
||
127 | * @Route("/api/users", methods={"GET"}) |
||
128 | * @SWG\Response( |
||
129 | * description="REST action which returns all users.", |
||
130 | * response=200, |
||
131 | * @SWG\Schema( |
||
132 | * type="array", |
||
133 | * @SWG\Items(ref=@Model(type=User::class, groups={"full"})) |
||
134 | * ) |
||
135 | * ) |
||
136 | * |
||
137 | * @return User[] |
||
138 | */ |
||
139 | 2 | public function getAll() |
|
151 | } |