use of com.furyviewer.domain.FavouriteMovie in project FuryViewer by TheDoctor-95.
the class FavouriteMovieResource method favouriteMovie.
@PostMapping("/favourite-movies/id/{idMovie}/liked")
@Timed
public ResponseEntity<FavouriteMovie> favouriteMovie(@PathVariable Long idMovie) throws URISyntaxException {
log.debug("REST request to save FavouriteMovie : {}", idMovie);
Movie m = movieRepository.findOne(idMovie);
FavouriteMovie fM = new FavouriteMovie();
fM.setMovie(m);
fM.setLiked(true);
return createFavouriteMovie(fM);
}
use of com.furyviewer.domain.FavouriteMovie in project FuryViewer by TheDoctor-95.
the class FavouriteMovieResource method updateFavouriteMovie.
/**
* PUT /favourite-movies : Updates an existing favouriteMovie.
*
* @param favouriteMovie the favouriteMovie to update
* @return the ResponseEntity with status 200 (OK) and with body the updated favouriteMovie,
* or with status 400 (Bad Request) if the favouriteMovie is not valid,
* or with status 500 (Internal Server Error) if the favouriteMovie couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/favourite-movies")
@Timed
public ResponseEntity<FavouriteMovie> updateFavouriteMovie(@RequestBody FavouriteMovie favouriteMovie) throws URISyntaxException {
log.debug("REST request to update FavouriteMovie : {}", favouriteMovie);
if (favouriteMovie.getId() == null) {
return createFavouriteMovie(favouriteMovie);
}
FavouriteMovie result = favouriteMovieRepository.save(favouriteMovie);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, favouriteMovie.getId().toString())).body(result);
}
use of com.furyviewer.domain.FavouriteMovie in project FuryViewer by TheDoctor-95.
the class FavouriteMovieResource method getFavouriteMovie.
/**
* GET /favourite-movies/:id : get the "id" favouriteMovie.
*
* @param id the id of the favouriteMovie to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the favouriteMovie, or with status 404 (Not Found)
*/
@GetMapping("/favourite-movies/{id}")
@Timed
public ResponseEntity<FavouriteMovie> getFavouriteMovie(@PathVariable Long id) {
log.debug("REST request to get FavouriteMovie : {}", id);
FavouriteMovie favouriteMovie = favouriteMovieRepository.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(favouriteMovie));
}
Aggregations