Search in sources :

Example 6 with Season

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

the class SeasonResource method getSeason.

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

Example 7 with Season

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

the class SeasonResource method updateSeason.

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

Aggregations

Season (com.furyviewer.domain.Season)7 Timed (com.codahale.metrics.annotation.Timed)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Episode (com.furyviewer.domain.Episode)1 ChapterSeenRepository (com.furyviewer.repository.ChapterSeenRepository)1 EpisodeRepository (com.furyviewer.repository.EpisodeRepository)1 SeriesStatsRepository (com.furyviewer.repository.SeriesStatsRepository)1 SecurityUtils (com.furyviewer.security.SecurityUtils)1 EpisodesHomeDTO (com.furyviewer.service.dto.util.EpisodesHomeDTO)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Optional (java.util.Optional)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1