|
1 | | -package tv.codely.apps.backoffice.frontend.controller.courses; |
| 1 | +package tv.codely.apps.backoffice.backend.controller.courses; |
2 | 2 |
|
3 | | -import org.springframework.web.bind.annotation.GetMapping; |
4 | | -import org.springframework.web.bind.annotation.RequestParam; |
5 | | -import org.springframework.web.bind.annotation.RestController; |
| 3 | +import org.springframework.web.bind.annotation.*; |
6 | 4 | import tv.codely.backoffice.courses.application.BackofficeCoursesResponse; |
7 | 5 | import tv.codely.backoffice.courses.application.search_by_criteria.SearchBackofficeCoursesByCriteriaQuery; |
8 | 6 | import tv.codely.shared.domain.bus.query.QueryBus; |
|
17 | 15 | import java.util.stream.Collectors; |
18 | 16 |
|
19 | 17 | @RestController |
20 | | -public final class ApiCoursesGetController { |
| 18 | +@CrossOrigin(origins = "*", methods = {RequestMethod.GET}) |
| 19 | +public final class CoursesGetController { |
21 | 20 | private final QueryBus bus; |
22 | 21 |
|
23 | | - public ApiCoursesGetController(QueryBus bus) { |
| 22 | + public CoursesGetController(QueryBus bus) { |
24 | 23 | this.bus = bus; |
25 | 24 | } |
26 | 25 |
|
27 | | - @GetMapping("/api/courses") |
28 | | - public List<HashMap<String, String>> index(@RequestParam HashMap<String, Serializable> params) throws QueryNotRegisteredError, QueryHandlerExecutionError { |
| 26 | + @GetMapping("/courses") |
| 27 | + public List<HashMap<String, String>> index( |
| 28 | + @RequestParam HashMap<String, Serializable> params |
| 29 | + ) throws QueryNotRegisteredError, QueryHandlerExecutionError { |
29 | 30 | BackofficeCoursesResponse courses = bus.ask( |
30 | 31 | new SearchBackofficeCoursesByCriteriaQuery( |
31 | 32 | parseFilters(params), |
|
0 commit comments