src/main/java/com/kshrd/derphsar_api/rest/restcontroller/PromotionRestController.java
/**
     * Get a promotion
     *
     * @param promoId - Id of a promotion
     * @return - Return response message
     */
Get a promotion
@param promoId - Id of a promotion
@return - Return response message
Get a promotion @param promoId - Id of a promotion @return - Return response message
@GetMapping("/promotions/{promoId}")
    @ApiOperation(value = "get a promotion by a promotion id", response = PromotionResponseModel.class)
    public ResponseEntity<BaseApiNoPaginationResponse<List<PromotionResponseModel>>> findById(@PathVariable("promoId") String promoId){
        ModelMapper mapper = new ModelMapper();
        BaseApiNoPaginationResponse<List<PromotionResponseModel>> response =
                new BaseApiNoPaginationResponse<>();
        List<PromotionResponseModel> promotionRequestModels = new ArrayList<>();
        PromotionDto promotionDto = promotionServiceImp.findById(promoId);
        if(promotionDto != null){
            promotionRequestModels.add(mapper.map(promotionDto, PromotionResponseModel.class));
            response.setMessage(message.selectedOne("Promotion"));
            response.setData(promotionRequestModels);
            response.setStatus(HttpStatus.FOUND);
        }else {
            response.setMessage(message.hasNoRecord("Promotion"));
            response.setStatus(HttpStatus.NOT_FOUND);
        }
        response.setTime(new Timestamp(System.currentTimeMillis()));
        return ResponseEntity.ok(response);
    }
@ GetMapping ( "/promotions/{promoId}" ) @ ApiOperation ( value = "get a promotion by a promotion id" , response = PromotionResponseModel . class ) public ResponseEntity < BaseApiNoPaginationResponse < List < PromotionResponseModel > > > findById ( @ PathVariable ( "promoId" ) String promoId ) { ModelMapper mapper = new ModelMapper ( ) ; BaseApiNoPaginationResponse < List < PromotionResponseModel > > response = new BaseApiNoPaginationResponse < > ( ) ; List < PromotionResponseModel > promotionRequestModels = new ArrayList < > ( ) ; PromotionDto promotionDto = promotionServiceImp . findById ( promoId ) ; if ( promotionDto != null ) { promotionRequestModels . add ( mapper . map ( promotionDto , PromotionResponseModel . class ) ) ; response . setMessage ( message . selectedOne ( "Promotion" ) ) ; response . setData ( promotionRequestModels ) ; response . setStatus ( HttpStatus . FOUND ) ; } else { response . setMessage ( message . hasNoRecord ( "Promotion" ) ) ; response . setStatus ( HttpStatus . NOT_FOUND ) ; } response . setTime ( new Timestamp ( System . currentTimeMillis ( ) ) ) ; return ResponseEntity . ok ( response ) ; }
Get a promotion
 @param promoId - Id of a promotion
 @return - Return response message
Get a promotion @param promoId - Id of a promotion @return - Return response message