@@ -11,37 +11,37 @@ |
||
11 | 11 | class ChangeApiKeyAction |
12 | 12 | { |
13 | 13 | |
14 | - public function __construct( |
|
14 | + public function __construct( |
|
15 | 15 | private EntityManagerInterface $manager, |
16 | 16 | private UserService $service, |
17 | 17 | private HydratorService $hydratorService |
18 | 18 | |
19 | - ) {} |
|
19 | + ) {} |
|
20 | 20 | |
21 | - public function __invoke(User $data) |
|
22 | - { |
|
21 | + public function __invoke(User $data) |
|
22 | + { |
|
23 | 23 | |
24 | 24 | try { |
25 | 25 | |
26 | - $user = $this->service->changeApiKey($data); |
|
26 | + $user = $this->service->changeApiKey($data); |
|
27 | 27 | |
28 | - return new JsonResponse( |
|
28 | + return new JsonResponse( |
|
29 | 29 | $this->hydratorService->item( |
30 | - User::class, |
|
31 | - $user->getId(), |
|
32 | - "user:read" |
|
30 | + User::class, |
|
31 | + $user->getId(), |
|
32 | + "user:read" |
|
33 | 33 | ) |
34 | - ); |
|
34 | + ); |
|
35 | 35 | } catch (\Exception $e) { |
36 | 36 | |
37 | - return new JsonResponse([ |
|
37 | + return new JsonResponse([ |
|
38 | 38 | 'response' => [ |
39 | - 'data' => [], |
|
40 | - 'count' => 0, |
|
41 | - 'error' => $e->getMessage(), |
|
42 | - 'success' => false, |
|
39 | + 'data' => [], |
|
40 | + 'count' => 0, |
|
41 | + 'error' => $e->getMessage(), |
|
42 | + 'success' => false, |
|
43 | 43 | ], |
44 | - ], 500); |
|
44 | + ], 500); |
|
45 | + } |
|
45 | 46 | } |
46 | - } |
|
47 | 47 | } |
@@ -13,43 +13,43 @@ |
||
13 | 13 | class CreateUserAction |
14 | 14 | { |
15 | 15 | |
16 | - public function __construct( |
|
16 | + public function __construct( |
|
17 | 17 | private EntityManagerInterface $manager, |
18 | 18 | private UserService $service, |
19 | 19 | private HydratorService $hydratorService |
20 | 20 | |
21 | - ) {} |
|
21 | + ) {} |
|
22 | 22 | |
23 | - public function __invoke(Request $request) |
|
24 | - { |
|
23 | + public function __invoke(Request $request) |
|
24 | + { |
|
25 | 25 | |
26 | 26 | try { |
27 | - $payload = json_decode($request->getContent()); |
|
28 | - $people = $this->manager->getRepository(People::class)->find($payload->people); |
|
27 | + $payload = json_decode($request->getContent()); |
|
28 | + $people = $this->manager->getRepository(People::class)->find($payload->people); |
|
29 | 29 | |
30 | - $user = $this->service->createUser( |
|
30 | + $user = $this->service->createUser( |
|
31 | 31 | $people, |
32 | 32 | $payload->username, |
33 | 33 | $payload->password |
34 | - ); |
|
34 | + ); |
|
35 | 35 | |
36 | - return new JsonResponse( |
|
36 | + return new JsonResponse( |
|
37 | 37 | $this->hydratorService->item( |
38 | - User::class, |
|
39 | - $user->getId(), |
|
40 | - "user:read" |
|
38 | + User::class, |
|
39 | + $user->getId(), |
|
40 | + "user:read" |
|
41 | 41 | ) |
42 | - ); |
|
42 | + ); |
|
43 | 43 | } catch (\Exception $e) { |
44 | 44 | |
45 | - return new JsonResponse([ |
|
45 | + return new JsonResponse([ |
|
46 | 46 | 'response' => [ |
47 | - 'data' => [], |
|
48 | - 'count' => 0, |
|
49 | - 'error' => $e->getMessage(), |
|
50 | - 'success' => false, |
|
47 | + 'data' => [], |
|
48 | + 'count' => 0, |
|
49 | + 'error' => $e->getMessage(), |
|
50 | + 'success' => false, |
|
51 | 51 | ], |
52 | - ], 500); |
|
52 | + ], 500); |
|
53 | + } |
|
53 | 54 | } |
54 | - } |
|
55 | 55 | } |
@@ -12,38 +12,38 @@ |
||
12 | 12 | class ChangePasswordAction |
13 | 13 | { |
14 | 14 | |
15 | - public function __construct( |
|
15 | + public function __construct( |
|
16 | 16 | private EntityManagerInterface $manager, |
17 | 17 | private UserService $service, |
18 | 18 | private HydratorService $hydratorService |
19 | 19 | |
20 | - ) {} |
|
20 | + ) {} |
|
21 | 21 | |
22 | - public function __invoke(User $data, Request $request) |
|
23 | - { |
|
22 | + public function __invoke(User $data, Request $request) |
|
23 | + { |
|
24 | 24 | |
25 | 25 | try { |
26 | - $payload = json_decode($request->getContent()); |
|
26 | + $payload = json_decode($request->getContent()); |
|
27 | 27 | |
28 | - $user = $this->service->changePassword($data, $payload->password); |
|
28 | + $user = $this->service->changePassword($data, $payload->password); |
|
29 | 29 | |
30 | - return new JsonResponse( |
|
30 | + return new JsonResponse( |
|
31 | 31 | $this->hydratorService->item( |
32 | - User::class, |
|
33 | - $user->getId(), |
|
34 | - "user:read" |
|
32 | + User::class, |
|
33 | + $user->getId(), |
|
34 | + "user:read" |
|
35 | 35 | ) |
36 | - ); |
|
36 | + ); |
|
37 | 37 | } catch (\Exception $e) { |
38 | 38 | |
39 | - return new JsonResponse([ |
|
39 | + return new JsonResponse([ |
|
40 | 40 | 'response' => [ |
41 | - 'data' => [], |
|
42 | - 'count' => 0, |
|
43 | - 'error' => $e->getMessage(), |
|
44 | - 'success' => false, |
|
41 | + 'data' => [], |
|
42 | + 'count' => 0, |
|
43 | + 'error' => $e->getMessage(), |
|
44 | + 'success' => false, |
|
45 | 45 | ], |
46 | - ], 500); |
|
46 | + ], 500); |
|
47 | + } |
|
47 | 48 | } |
48 | - } |
|
49 | 49 | } |