File tree Expand file tree Collapse file tree
api/src/main/java/com/grash/controller Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ public class CustomerController {
4343
4444 @ PostMapping ("/search" )
4545 @ PreAuthorize ("permitAll()" )
46- public ResponseEntity <Page <Customer >> search (@ Parameter (description = "Customer search criteria" ) @ RequestBody SearchCriteria searchCriteria , HttpServletRequest req ) {
46+ public ResponseEntity <Page <CustomerShowDTO >> search (@ Parameter (description = "Customer search criteria" ) @ RequestBody SearchCriteria searchCriteria , HttpServletRequest req ) {
4747 User user = userService .whoami (req );
4848 if (user .getRole ().getRoleType ().equals (RoleType .ROLE_CLIENT )) {
4949 if (user .getRole ().getViewPermissions ().contains (PermissionEntity .VENDORS_AND_CUSTOMERS )) {
5050 searchCriteria .filterCompany (user );
5151 } else throw new CustomException ("Access Denied" , HttpStatus .FORBIDDEN );
5252 }
53- return ResponseEntity .ok (customerService .findBySearchCriteria (searchCriteria ));
53+ return ResponseEntity .ok (customerService .findBySearchCriteria (searchCriteria ). map ( customerMapper :: toShowDto ) );
5454 }
5555
5656 @ GetMapping ("/mini" )
Original file line number Diff line number Diff line change @@ -44,14 +44,15 @@ public class VendorController {
4444
4545 @ PostMapping ("/search" )
4646 @ PreAuthorize ("permitAll()" )
47- public ResponseEntity <Page <Vendor >> search (@ Parameter (description = "Search criteria for filtering vendors" ) @ RequestBody SearchCriteria searchCriteria , HttpServletRequest req ) {
47+ public ResponseEntity <Page <VendorShowDTO >> search (@ Parameter (description = "Search criteria for filtering " +
48+ "vendors" ) @ RequestBody SearchCriteria searchCriteria , HttpServletRequest req ) {
4849 User user = userService .whoami (req );
4950 if (user .getRole ().getRoleType ().equals (RoleType .ROLE_CLIENT )) {
5051 if (user .getRole ().getViewPermissions ().contains (PermissionEntity .VENDORS_AND_CUSTOMERS )) {
5152 searchCriteria .filterCompany (user );
5253 } else throw new CustomException ("Access Denied" , HttpStatus .FORBIDDEN );
5354 }
54- return ResponseEntity .ok (vendorService .findBySearchCriteria (searchCriteria ));
55+ return ResponseEntity .ok (vendorService .findBySearchCriteria (searchCriteria ). map ( vendorMapper :: toShowDto ) );
5556 }
5657
5758 @ GetMapping ("/{id}" )
You can’t perform that action at this time.
0 commit comments