| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package fr.natan.akkastreamfileprocessingapi.controller;
-
- 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;
-
- @RestController
- public class MovieController {
-
- private final AkkaStreamFileProcessing akkaStreamFilesProcessing;
-
- public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) {
- this.akkaStreamFilesProcessing = akkaStreamFilesProcessing;
- }
-
- @RequestMapping(value = "/persons", method = RequestMethod.GET)
- private ResponseEntity<String> getallPersons(){
- akkaStreamFilesProcessing.getAllPersons();
- return new ResponseEntity<>("is running", HttpStatus.OK);
- }
-
- @RequestMapping(value = "/persons/id/{personID}", method = RequestMethod.GET)
- private ResponseEntity<String> getPersonByID(@PathVariable(name = "personID") String nconst){
-
- return new ResponseEntity<>(akkaStreamFilesProcessing.getPersonById(nconst).toString(), HttpStatus.OK);
-
- }
-
- @RequestMapping(value = "/persons/name/{primaryName}", method = RequestMethod.GET)
- private ResponseEntity<String> getPersonByName(@PathVariable(name = "primaryName") String primaryName){
- akkaStreamFilesProcessing.getPersonByName(primaryName);
- return new ResponseEntity<>("is running", HttpStatus.OK);
- }
-
- @RequestMapping(value = "/tvseries", method = RequestMethod.GET)
- private ResponseEntity<String> getAllvSeries() {
- akkaStreamFilesProcessing.getAllTvSeries();
- return new ResponseEntity<>("is running", HttpStatus.OK);
- }
-
- @RequestMapping(value = "/tvseries/{tvseriePrimaryTitle}", method = RequestMethod.GET)
- private ResponseEntity<String> getTvserieByPrimaryTitle(@PathVariable(name ="tvseriePrimaryTitle" ) String tvseriePrimaryTitle){
- akkaStreamFilesProcessing.getByTvSeriePrimaryTitle(tvseriePrimaryTitle);
- return new ResponseEntity<>("OK", HttpStatus.OK);
- }
-
- @RequestMapping(value = "/tvseries/title/{tvSerieTitle}", method = RequestMethod.GET)
- private ResponseEntity<String> getListOfPersonsIDByTvSerieID(@PathVariable(name = "tvSerieTitle") String tvSerieTitle){
- akkaStreamFilesProcessing.getPersonsTeamForTvSerie(tvSerieTitle);
- return new ResponseEntity<>("is running", HttpStatus.OK);
- }
- }
|