Skip to content

Commit b64efac

Browse files
committed
Move courses controller to backoffice backend
1 parent 46a8de4 commit b64efac

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

apps/main/resources/backoffice_frontend/templates/pages/courses/partials/list_courses.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@
142142
143143
const urlParts = inputs.map(input => input.name + "=" + input.value);
144144
145-
const url = "http://localhost:8080/api/courses?" + urlParts.join("&");
145+
const url = "http://localhost:8091/courses?" + urlParts.join("&");
146146
147147
addCoursesList(url);
148148
}
149149
</script>
150150

151151
<script>
152-
addCoursesList("http://localhost:8080/api/courses");
152+
addCoursesList("http://localhost:8091/courses");
153153
</script>
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
package tv.codely.apps.backoffice.frontend.controller.courses;
1+
package tv.codely.apps.backoffice.backend.controller.courses;
22

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.*;
64
import tv.codely.backoffice.courses.application.BackofficeCoursesResponse;
75
import tv.codely.backoffice.courses.application.search_by_criteria.SearchBackofficeCoursesByCriteriaQuery;
86
import tv.codely.shared.domain.bus.query.QueryBus;
@@ -17,15 +15,18 @@
1715
import java.util.stream.Collectors;
1816

1917
@RestController
20-
public final class ApiCoursesGetController {
18+
@CrossOrigin(origins = "*", methods = {RequestMethod.GET})
19+
public final class CoursesGetController {
2120
private final QueryBus bus;
2221

23-
public ApiCoursesGetController(QueryBus bus) {
22+
public CoursesGetController(QueryBus bus) {
2423
this.bus = bus;
2524
}
2625

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 {
2930
BackofficeCoursesResponse courses = bus.ask(
3031
new SearchBackofficeCoursesByCriteriaQuery(
3132
parseFilters(params),

0 commit comments

Comments
 (0)