Search in sources :

Example 6 with FavouriteMovie

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);
}
Also used : Movie(com.furyviewer.domain.Movie) FavouriteMovie(com.furyviewer.domain.FavouriteMovie) FavouriteMovie(com.furyviewer.domain.FavouriteMovie) Timed(com.codahale.metrics.annotation.Timed)

Example 7 with FavouriteMovie

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);
}
Also used : FavouriteMovie(com.furyviewer.domain.FavouriteMovie) Timed(com.codahale.metrics.annotation.Timed)

Example 8 with FavouriteMovie

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));
}
Also used : FavouriteMovie(com.furyviewer.domain.FavouriteMovie) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

FavouriteMovie (com.furyviewer.domain.FavouriteMovie)8 Timed (com.codahale.metrics.annotation.Timed)5 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Movie (com.furyviewer.domain.Movie)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1