Search in sources :

Example 1 with ArtistTypeEnum

use of com.furyviewer.domain.enumeration.ArtistTypeEnum in project FuryViewer by TheDoctor-95.

the class ArtistResource method findArtistByArtistType.

@GetMapping("/artist-types-name/{artistTypeStr}")
@Timed
public ResponseEntity<List<Artist>> findArtistByArtistType(@PathVariable String artistTypeStr) {
    log.debug("REST request to get ArtistType : {}", artistTypeStr);
    try {
        ArtistTypeEnum ate = ArtistTypeEnum.valueOf(artistTypeStr.toUpperCase());
        ArtistType artistType = artistTypeRepository.findByName(ate);
        List<Artist> artists = artistRepository.findArtistByArtistType(artistType);
        return ResponseUtil.wrapOrNotFound(Optional.ofNullable(artists));
    } catch (IllegalArgumentException e) {
        throw new BadRequestAlertException(e.getMessage(), ENTITY_NAME, e.getLocalizedMessage());
    }
}
Also used : Artist(com.furyviewer.domain.Artist) BadRequestAlertException(com.furyviewer.web.rest.errors.BadRequestAlertException) ArtistTypeEnum(com.furyviewer.domain.enumeration.ArtistTypeEnum) ArtistType(com.furyviewer.domain.ArtistType) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 Artist (com.furyviewer.domain.Artist)1 ArtistType (com.furyviewer.domain.ArtistType)1 ArtistTypeEnum (com.furyviewer.domain.enumeration.ArtistTypeEnum)1 BadRequestAlertException (com.furyviewer.web.rest.errors.BadRequestAlertException)1