Untitled
unknown
java
2 years ago
1.1 kB
9
Indexable
public ResponseEntity<Page<ReportResponse>> getAll(ReportFilterRequest request, @RequestHeader(value = AUTHORIZATION) String token, @RequestParam(name = "page", required = false, defaultValue = Constant.PAGINATION.DEFAULT_PAGE_NUMBER) int page, @RequestParam(name = "size", required = false, defaultValue = Constant.PAGINATION.DEFAULT_PAGE_SIZE) int size, @RequestParam(name = "sortBy", required = false, defaultValue = Constant.SORT.DEFAULT_SORT_BY) String field, @RequestParam(name = "sortDir", required = false, defaultValue = Constant.SORT.DEFAULT_SORT_DIRECTION) String direction) { token = token.substring("Bearer ".length()); String username = jwtTokenUtil.getUsernameFromJwt(token); Account account = accountService.getAccountByUsername(username); Pageable pageable = PaginationAndSortFactory.getPagable(size, page, field, direction); Page<Report> list = reportService.findByStatus(pageable, request, account); Page<ReportResponse> responses = list.map(feedbackMapper::mapReportToReportResponse); return new ResponseEntity<>(responses, HttpStatus.OK); }
Editor is loading...