package fr.natan.akkastreamfileprocessingapi.controller; import fr.natan.akkastreamfileprocessingapi.models.Models; import fr.natan.akkastreamfileprocessingapi.service.AkkaStreamFileProcessing; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import scala.collection.IndexedSeq; import scala.concurrent.Future; @SuppressWarnings("SpellCheckingInspection") @RestController public class MovieController { private final AkkaStreamFileProcessing akkaStreamFilesProcessing; public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) { this.akkaStreamFilesProcessing = akkaStreamFilesProcessing; } @RequestMapping(value = "/persons/id/{personID}", method = RequestMethod.GET) private Future getPersonByID(@PathVariable(name = "personID") String nconst){ return akkaStreamFilesProcessing.getPersonById(nconst); } @RequestMapping(value = "/persons/name/{primaryName}", method = RequestMethod.GET) private Future> getPersonByName(@PathVariable(name = "primaryName") String primaryName){ return akkaStreamFilesProcessing.getPersonByName(primaryName); } @RequestMapping(value = "/tvseries/{tvseriePrimaryTitle}", method = RequestMethod.GET) private Future> getTvserieByPrimaryTitle(@PathVariable(name ="tvseriePrimaryTitle" ) String tvseriePrimaryTitle){ return akkaStreamFilesProcessing.getTvSerieByPrimaryTitle(tvseriePrimaryTitle); } @RequestMapping(value = "/tvseries/title/{tvSerieTitle}", method = RequestMethod.GET) private Future> getPersonsForTvSerie(@PathVariable(name = "tvSerieTitle") String tvSerieTitle){ return akkaStreamFilesProcessing.getPersonsTeamForTvSerie(tvSerieTitle); } @RequestMapping(value = "/persons", method = RequestMethod.GET) private ResponseEntity getAllPersons(){ akkaStreamFilesProcessing.getAllPersons(); return new ResponseEntity<>("is running", HttpStatus.OK); } @RequestMapping(value = "/tvseries", method = RequestMethod.GET) private ResponseEntity getAllvSeries() { akkaStreamFilesProcessing.getAllTvSeries(); return new ResponseEntity<>("is running", HttpStatus.OK); } }