Search in sources :

Example 6 with RateMovie

use of com.furyviewer.domain.RateMovie in project FuryViewer by TheDoctor-95.

the class RateMovieResource method getRateMovie.

/**
 * GET  /rate-movies/:id : get the "id" rateMovie.
 *
 * @param id the id of the rateMovie to retrieve
 * @return the ResponseEntity with status 200 (OK) and with body the rateMovie, or with status 404 (Not Found)
 */
@GetMapping("/rate-movies/{id}")
@Timed
public ResponseEntity<RateMovie> getRateMovie(@PathVariable Long id) {
    log.debug("REST request to get RateMovie : {}", id);
    RateMovie rateMovie = rateMovieRepository.findOne(id);
    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(rateMovie));
}
Also used : RateMovie(com.furyviewer.domain.RateMovie) Timed(com.codahale.metrics.annotation.Timed)

Example 7 with RateMovie

use of com.furyviewer.domain.RateMovie in project FuryViewer by TheDoctor-95.

the class RateMovieResource method RateMovie.

@PostMapping("/rate-movies/id/{idMovie}/rate/{rate}")
@Timed
public ResponseEntity<RateMovie> RateMovie(@PathVariable Long idMovie, @PathVariable int rate) throws URISyntaxException {
    Movie m = movieRepository.findOne(idMovie);
    RateMovie rm = new RateMovie();
    rm.setMovie(m);
    rm.setRate(rate);
    return createRateMovie(rm);
}
Also used : Movie(com.furyviewer.domain.Movie) RateMovie(com.furyviewer.domain.RateMovie) RateMovie(com.furyviewer.domain.RateMovie) Timed(com.codahale.metrics.annotation.Timed)

Example 8 with RateMovie

use of com.furyviewer.domain.RateMovie in project FuryViewer by TheDoctor-95.

the class RateMovieResource method updateRateMovie.

/**
 * PUT  /rate-movies : Updates an existing rateMovie.
 *
 * @param rateMovie the rateMovie to update
 * @return the ResponseEntity with status 200 (OK) and with body the updated rateMovie,
 * or with status 400 (Bad Request) if the rateMovie is not valid,
 * or with status 500 (Internal Server Error) if the rateMovie couldn't be updated
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PutMapping("/rate-movies")
@Timed
public ResponseEntity<RateMovie> updateRateMovie(@RequestBody RateMovie rateMovie) throws URISyntaxException {
    log.debug("REST request to update RateMovie : {}", rateMovie);
    if (rateMovie.getId() == null) {
        return createRateMovie(rateMovie);
    }
    RateMovie result = rateMovieRepository.save(rateMovie);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, rateMovie.getId().toString())).body(result);
}
Also used : RateMovie(com.furyviewer.domain.RateMovie) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

RateMovie (com.furyviewer.domain.RateMovie)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