Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with Paging #86

Open
leonAtRain opened this issue Mar 15, 2024 · 1 comment
Open

Help with Paging #86

leonAtRain opened this issue Mar 15, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@leonAtRain
Copy link

leonAtRain commented Mar 15, 2024

Ask a question

I've manually implemented this code on a controller, but I don't know how implement this on an Intent Module:

@GetMapping
    @Operation(summary = "findAll")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "Returns the specified List<CustomerBillDto>."),
            @ApiResponse(responseCode = "400", description = "One or more validation errors have occurred.")})
    @IntentIgnore
    public ResponseEntity<Page<CustomerBillDto>> findAll(@RequestParam(value = "fields", required = false) String[] fields,
                                                         @RequestParam Map<String, String> filtering, Pageable pageable) {
        if (pageable.isUnpaged()) {
            pageable = PageRequest.of(0, 500);
        }
        final Page<CustomerBillDto> result = customerBillService.findAll(fields, filtering, pageable);
        if (result.getTotalElements() == 0) {
            return new ResponseEntity<>(HttpStatus.NOT_FOUND);
        }
        HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), result);

        return ResponseEntity.ok().headers(headers).body(result.getContent());
    }

This is how the Intent side looks like :
image

The thing is - I want the Paging to be added on Intent side as well as the Generic return Page object and headers.

I also have a few Projects that need this so I would want to add it to my module and apply it to all the projects that have "findAll" endpoints exposed.

@leonAtRain leonAtRain added the question Further information is requested label Mar 15, 2024
@joelsteventurner joelsteventurner self-assigned this Mar 15, 2024
@joelsteventurner
Copy link
Member

Hi @leonAtRain

We have a similar pattern in the .Net space. We'll reach out to you today over Teams to set up a session and unpack this requirement with you help you get this implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants