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