47 lines
1.5 KiB
Java
47 lines
1.5 KiB
Java
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<Bundle> searchBundles( @RequestParam String term ) {
|
|
return bundleService.getBundleByIdAndItemIdAndSku( term );
|
|
}
|
|
|
|
@GetMapping( "/master/search" )
|
|
public List<MasterBundle> searchMasterBundle( @RequestParam String term,
|
|
@RequestParam boolean received ){
|
|
return bundleService.getMasterBundleByIdTerm( term, received );
|
|
}
|
|
|
|
@GetMapping( "/find-by-master/{masterId}" )
|
|
public List<Bundle> 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<Bundle> findByMasterBarcode(@RequestParam String term ){
|
|
return bundleService.getBundles( term );
|
|
}
|
|
}
|