Skip to content

Commit

Permalink
Move courses controller to backoffice backend
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Nov 25, 2019
1 parent 46a8de4 commit b64efac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@
const urlParts = inputs.map(input => input.name + "=" + input.value);
const url = "http://localhost:8080/api/courses?" + urlParts.join("&");
const url = "http://localhost:8091/courses?" + urlParts.join("&");
addCoursesList(url);
}
</script>

<script>
addCoursesList("http://localhost:8080/api/courses");
addCoursesList("http://localhost:8091/courses");
</script>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package tv.codely.apps.backoffice.frontend.controller.courses;
package tv.codely.apps.backoffice.backend.controller.courses;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import tv.codely.backoffice.courses.application.BackofficeCoursesResponse;
import tv.codely.backoffice.courses.application.search_by_criteria.SearchBackofficeCoursesByCriteriaQuery;
import tv.codely.shared.domain.bus.query.QueryBus;
Expand All @@ -17,15 +15,18 @@
import java.util.stream.Collectors;

@RestController
public final class ApiCoursesGetController {
@CrossOrigin(origins = "*", methods = {RequestMethod.GET})
public final class CoursesGetController {
private final QueryBus bus;

public ApiCoursesGetController(QueryBus bus) {
public CoursesGetController(QueryBus bus) {
this.bus = bus;
}

@GetMapping("/api/courses")
public List<HashMap<String, String>> index(@RequestParam HashMap<String, Serializable> params) throws QueryNotRegisteredError, QueryHandlerExecutionError {
@GetMapping("/courses")
public List<HashMap<String, String>> index(
@RequestParam HashMap<String, Serializable> params
) throws QueryNotRegisteredError, QueryHandlerExecutionError {
BackofficeCoursesResponse courses = bus.ask(
new SearchBackofficeCoursesByCriteriaQuery(
parseFilters(params),
Expand Down

0 comments on commit b64efac

Please sign in to comment.