package com.utopiaindustries.restcontroller; import com.utopiaindustries.model.ctp.Bundle; import com.utopiaindustries.model.ctp.MasterBundle; import com.utopiaindustries.service.BundleService; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping( "/rest/bundles" ) public class BundleRestController { private final BundleService bundleService; public BundleRestController(BundleService bundleService) { this.bundleService = bundleService; } @GetMapping("/search") public List searchBundles( @RequestParam String term ) { return bundleService.getBundleByIdAndItemIdAndSku( term ); } @GetMapping( "/master/search" ) public List searchMasterBundle( @RequestParam String term, @RequestParam boolean received ){ return bundleService.getMasterBundleByIdTerm( term, received ); } @GetMapping( "/find-by-master/{masterId}" ) public List findByMasterBarcode( @PathVariable("masterId") long masterId ){ return bundleService.findBundlesByMasterId( masterId ); } @GetMapping( "/find-bundle-by-id/{id}" ) public Bundle findBundleById( @PathVariable("id") long id ){ return bundleService.getBundlesById(id); } @GetMapping( "/find-bundle-by-barcode" ) public List findByMasterBarcode(@RequestParam String term ){ return bundleService.getBundles( term ); } }