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