31 lines
1.2 KiB
Java
31 lines
1.2 KiB
Java
package SuMoC.backend.carrousel.controller;
|
|
|
|
import SuMoC.backend.carrousel.dto.AlternativeCarrouselDTO;
|
|
import SuMoC.backend.carrousel.service.CarrouselService;
|
|
import SuMoC.backend.user.service.CurrentUserService;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* Controller for providing a carrousel of alternative routes for displaying on the app startpage.
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/routing/alternative/carrousel")
|
|
@RequiredArgsConstructor
|
|
public class RoutingAlternativeCarrouselController {
|
|
|
|
private final CarrouselService carrouselService;
|
|
|
|
private final CurrentUserService currentUserService;
|
|
|
|
@GetMapping("/request")
|
|
@Schema(description = "Provides a carrousel of alternative routes for displaying on the app startpage.")
|
|
public ResponseEntity<AlternativeCarrouselDTO> getAlternativeCarrousel() {
|
|
return ResponseEntity.ok(carrouselService.getCarrouselForUser(currentUserService.get().getId()));
|
|
}
|
|
}
|