|
15 | 15 |
|
16 | 16 | final readonly class CoursesGetController |
17 | 17 | { |
18 | | - public function __construct(private QueryBus $queryBus) |
19 | | - { |
20 | | - } |
| 18 | + public function __construct(private QueryBus $queryBus) {} |
21 | 19 |
|
22 | 20 | public function __invoke(Request $request): JsonResponse |
23 | 21 | { |
24 | 22 | $orderBy = $request->query->get('order_by'); |
25 | 23 | $order = $request->query->get('order'); |
26 | | - $limit = $request->query->get('limit'); |
| 24 | + $limit = $request->query->get('limit'); |
27 | 25 | $offset = $request->query->get('offset'); |
28 | 26 |
|
29 | 27 | /** @var BackofficeCoursesResponse $response */ |
30 | 28 | $response = $this->queryBus->ask( |
31 | 29 | new SearchBackofficeCoursesByCriteriaQuery( |
32 | 30 | (array) $request->query->get('filters'), |
33 | | - null === $orderBy ? null : (string) $orderBy, |
34 | | - null === $order ? null : (string) $order, |
35 | | - null === $limit ? null : (int) $limit, |
36 | | - null === $offset ? null : (int) $offset |
| 31 | + $orderBy === null ? null : (string) $orderBy, |
| 32 | + $order === null ? null : (string) $order, |
| 33 | + $limit === null ? null : (int) $limit, |
| 34 | + $offset === null ? null : (int) $offset |
37 | 35 | ) |
38 | 36 | ); |
39 | 37 |
|
40 | 38 | return new JsonResponse( |
41 | 39 | map( |
42 | 40 | fn (BackofficeCourseResponse $course) => [ |
43 | | - 'id' => $course->id(), |
44 | | - 'name' => $course->name(), |
| 41 | + 'id' => $course->id(), |
| 42 | + 'name' => $course->name(), |
45 | 43 | 'duration' => $course->duration(), |
46 | 44 | ], |
47 | 45 | $response->courses() |
|
0 commit comments