Search in sources :

Example 11 with BadRequestAlertException

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

the class SocialResource method createSocial.

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

Example 12 with BadRequestAlertException

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

the class CompanyResource method createCompany.

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

Example 13 with BadRequestAlertException

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

the class EpisodeResource method createEpisode.

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

Example 14 with BadRequestAlertException

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

the class ChapterSeenResource method createChapterSeen.

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

Example 15 with BadRequestAlertException

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

the class CountryResource method createCountry.

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