Search in sources :

Example 6 with Achievement

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

the class AchievementResource method updateAchievement.

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

Aggregations

Achievement (com.furyviewer.domain.Achievement)6 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 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1