use of com.dubion.domain.FavouriteAlbum in project dubion by valsamiq.
the class FavouriteAlbumResource method getFavouriteAlbum.
/**
* GET /favourite-albums/:id : get the "id" favouriteAlbum.
*
* @param id the id of the favouriteAlbum to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the favouriteAlbum, or with status 404 (Not Found)
*/
@GetMapping("/favourite-albums/{id}")
@Timed
public ResponseEntity<FavouriteAlbum> getFavouriteAlbum(@PathVariable Long id) {
log.debug("REST request to get FavouriteAlbum : {}", id);
FavouriteAlbum favouriteAlbum = favouriteAlbumService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(favouriteAlbum));
}
use of com.dubion.domain.FavouriteAlbum in project dubion by valsamiq.
the class FavouriteAlbumResource method updateFavouriteAlbum.
/**
* PUT /favourite-albums : Updates an existing favouriteAlbum.
*
* @param favouriteAlbum the favouriteAlbum to update
* @return the ResponseEntity with status 200 (OK) and with body the updated favouriteAlbum,
* or with status 400 (Bad Request) if the favouriteAlbum is not valid,
* or with status 500 (Internal Server Error) if the favouriteAlbum couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/favourite-albums")
@Timed
public ResponseEntity<FavouriteAlbum> updateFavouriteAlbum(@RequestBody FavouriteAlbum favouriteAlbum) throws URISyntaxException {
log.debug("REST request to update FavouriteAlbum : {}", favouriteAlbum);
if (favouriteAlbum.getId() == null) {
return createFavouriteAlbum(favouriteAlbum);
}
FavouriteAlbum result = favouriteAlbumService.save(favouriteAlbum);
return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, favouriteAlbum.getId().toString())).body(result);
}
use of com.dubion.domain.FavouriteAlbum in project dubion by valsamiq.
the class FavouriteAlbumResource method createFavouriteAlbum.
/**
* POST /favourite-albums : Create a new favouriteAlbum.
*
* @param favouriteAlbum the favouriteAlbum to create
* @return the ResponseEntity with status 201 (Created) and with body the new favouriteAlbum, or with status 400 (Bad Request) if the favouriteAlbum has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/favourite-albums")
@Timed
public ResponseEntity<FavouriteAlbum> createFavouriteAlbum(@RequestBody FavouriteAlbum favouriteAlbum) throws URISyntaxException {
log.debug("REST request to save FavouriteAlbum : {}", favouriteAlbum);
if (favouriteAlbum.getId() != null) {
throw new BadRequestAlertException("A new favouriteAlbum cannot already have an ID", ENTITY_NAME, "idexists");
}
FavouriteAlbum result = favouriteAlbumService.save(favouriteAlbum);
return ResponseEntity.created(new URI("/api/favourite-albums/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Aggregations