Search in sources :

Example 26 with BadRequestAlertException

use of com.furyviewer.web.rest.errors.BadRequestAlertException in project FuryViewer by TheDoctor-95.

the class SeriesResource method createSeries.

/**
 * POST  /series : Create a new series.
 *
 * @param series the series to create
 * @return the ResponseEntity with status 201 (Created) and with body the new series, or with status 400 (Bad Request) if the series has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/series")
@Timed
public ResponseEntity<Series> createSeries(@RequestBody Series series) throws URISyntaxException {
    log.debug("REST request to save Series : {}", series);
    if (series.getId() != null) {
        throw new BadRequestAlertException("A new series cannot already have an ID", ENTITY_NAME, "idexists");
    }
    Series result = seriesRepository.save(series);
    return ResponseEntity.created(new URI("/api/series/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) Series(com.furyviewer.domain.Series) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Example 27 with BadRequestAlertException

use of com.furyviewer.web.rest.errors.BadRequestAlertException in project FuryViewer by TheDoctor-95.

the class UserExtResource method createUserExt.

/**
 * POST  /user-exts : Create a new userExt.
 *
 * @param userExt the userExt to create
 * @return the ResponseEntity with status 201 (Created) and with body the new userExt, or with status 400 (Bad Request) if the userExt has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/user-exts")
@Timed
public ResponseEntity<UserExt> createUserExt(@RequestBody UserExt userExt) throws URISyntaxException {
    log.debug("REST request to save UserExt : {}", userExt);
    if (userExt.getId() != null) {
        throw new BadRequestAlertException("A new userExt cannot already have an ID", ENTITY_NAME, "idexists");
    }
    UserExt result = userExtRepository.save(userExt);
    return ResponseEntity.created(new URI("/api/user-exts/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) UserExt(com.furyviewer.domain.UserExt) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Example 28 with BadRequestAlertException

use of com.furyviewer.web.rest.errors.BadRequestAlertException in project FuryViewer by TheDoctor-95.

the class SeriesStatsResource method createSeriesStats.

/**
 * POST  /series-stats : Create a new seriesStats.
 *
 * @param seriesStats the seriesStats to create
 * @return the ResponseEntity with status 201 (Created) and with body the new seriesStats, or with status 400 (Bad Request) if the seriesStats has already an ID
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/series-stats")
@Timed
public ResponseEntity<SeriesStats> createSeriesStats(@RequestBody SeriesStats seriesStats) throws URISyntaxException {
    log.debug("REST request to save SeriesStats : {}", seriesStats);
    if (seriesStats.getId() != null) {
        throw new BadRequestAlertException("A new seriesStats cannot already have an ID", ENTITY_NAME, "idexists");
    }
    SeriesStats result = seriesStatsRepository.save(seriesStats);
    return ResponseEntity.created(new URI("/api/series-stats/" + result.getId())).headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
Also used : BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) SeriesStats(com.furyviewer.domain.SeriesStats) URI(java.net.URI) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)28 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)28 URI (java.net.URI)27 Artist (com.furyviewer.domain.Artist)2 ArtistType (com.furyviewer.domain.ArtistType)2 Achievement (com.furyviewer.domain.Achievement)1 AchievementsAchievs (com.furyviewer.domain.AchievementsAchievs)1 ChapterSeen (com.furyviewer.domain.ChapterSeen)1 Company (com.furyviewer.domain.Company)1 Country (com.furyviewer.domain.Country)1 Episode (com.furyviewer.domain.Episode)1 FavouriteArtist (com.furyviewer.domain.FavouriteArtist)1 FavouriteMovie (com.furyviewer.domain.FavouriteMovie)1 FavouriteSeries (com.furyviewer.domain.FavouriteSeries)1 Genre (com.furyviewer.domain.Genre)1 HatredArtist (com.furyviewer.domain.HatredArtist)1 HatredMovie (com.furyviewer.domain.HatredMovie)1 HatredSeries (com.furyviewer.domain.HatredSeries)1 Movie (com.furyviewer.domain.Movie)1 MovieStats (com.furyviewer.domain.MovieStats)1