No Description

MovieController.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package fr.natan.akkastreamfileprocessingapi.controller;
  2. import fr.natan.akkastreamfileprocessingapi.service.AkkaStreamFileProcessing;
  3. import org.springframework.http.HttpStatus;
  4. import org.springframework.http.ResponseEntity;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.RestController;
  9. @SuppressWarnings("SpellCheckingInspection")
  10. @RestController
  11. public class MovieController {
  12. private final AkkaStreamFileProcessing akkaStreamFilesProcessing;
  13. public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) {
  14. this.akkaStreamFilesProcessing = akkaStreamFilesProcessing;
  15. }
  16. @RequestMapping(value = "/persons", method = RequestMethod.GET)
  17. private ResponseEntity<String> getAllPersons(){
  18. akkaStreamFilesProcessing.getAllPersons();
  19. return new ResponseEntity<>("is running", HttpStatus.OK);
  20. }
  21. @RequestMapping(value = "/persons/id/{personID}", method = RequestMethod.GET)
  22. private ResponseEntity<String> getPersonByID(@PathVariable(name = "personID") String nconst){
  23. return new ResponseEntity<>(akkaStreamFilesProcessing.getPersonById(nconst).toString(), HttpStatus.OK);
  24. }
  25. @RequestMapping(value = "/persons/name/{primaryName}", method = RequestMethod.GET)
  26. private ResponseEntity<String> getPersonByName(@PathVariable(name = "primaryName") String primaryName){
  27. akkaStreamFilesProcessing.getPersonByName(primaryName);
  28. return new ResponseEntity<>("is running", HttpStatus.OK);
  29. }
  30. @RequestMapping(value = "/tvseries", method = RequestMethod.GET)
  31. private ResponseEntity<String> getAllvSeries() {
  32. akkaStreamFilesProcessing.getAllTvSeries();
  33. return new ResponseEntity<>("is running", HttpStatus.OK);
  34. }
  35. @RequestMapping(value = "/tvseries/{tvseriePrimaryTitle}", method = RequestMethod.GET)
  36. private ResponseEntity<String> getTvserieByPrimaryTitle(@PathVariable(name ="tvseriePrimaryTitle" ) String tvseriePrimaryTitle){
  37. akkaStreamFilesProcessing.getByTvSeriePrimaryTitle(tvseriePrimaryTitle);
  38. return new ResponseEntity<>("OK", HttpStatus.OK);
  39. }
  40. @RequestMapping(value = "/tvseries/title/{tvSerieTitle}", method = RequestMethod.GET)
  41. private ResponseEntity<String> getListOfPersonsForTvSerie(@PathVariable(name = "tvSerieTitle") String tvSerieTitle){
  42. akkaStreamFilesProcessing.getPersonsTeamForTvSerie(tvSerieTitle);
  43. return new ResponseEntity<>("is running", HttpStatus.OK);
  44. }
  45. }

Powered by TurnKey Linux.