Skip to content

Pass pgcql.Query for patron requests#618

Merged
jakub-id merged 3 commits into
mainfrom
pass-pgcql-query-for-patron-requests
May 27, 2026
Merged

Pass pgcql.Query for patron requests#618
jakub-id merged 3 commits into
mainfrom
pass-pgcql-query-for-patron-requests

Conversation

@adamdickmeiss
Copy link
Copy Markdown
Contributor

@adamdickmeiss adamdickmeiss commented May 27, 2026

Should ParsePatronRequestsCQL be part of the PrRepo interface?

Copilot AI review requested due to automatic review settings May 27, 2026 15:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors patron request listing/faceting to pass a parsed pgcql.Query through the repo layer (instead of passing raw CQL strings), so CQL parsing/validation happens at API boundaries and the repo only consumes validated SQL fragments/args.

Changes:

  • Update PrRepo interfaces and implementations to accept pgcql.Query for listing patron requests/search view and fetching facets.
  • Export ParsePatronRequestsCQL and update API handlers/tests to parse CQL before calling repo methods.
  • Adjust the facets SQL template to use parameterized LIMIT/OFFSET so facet queries can safely prepend base args.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
broker/patron_request/db/prrepo.go Repo interface + Pg repo methods now take pgcql.Query for list/search/facets.
broker/patron_request/db/prcql.go Export CQL parsing helper; update CQL→SQL assembly and facets query to accept pgcql.Query.
broker/sqlc/pr_query.sql Parameterize facets query LIMIT/OFFSET to support base args prepending.
broker/patron_request/api/api-handler.go Parse/validate CQL before listing and faceting patron requests.
broker/patron_request/api/api-handler_test.go Update tests to assert against pgcql.Query where clause instead of raw CQL strings.
broker/pullslip/api/api_handler.go Parse/validate CQL before listing patron requests for PDF generation.
broker/pullslip/api/api_handler_test.go Update mocks to accept pgcql.Query in ListPatronRequests.
broker/test/patron_request/db/prrepo_test.go Update repo integration test to pass parsed pgcql.Query to list calls.
broker/patron_request/db/prcql_test.go Update unit tests to use the exported parse function and testify assertions.

Comment thread broker/patron_request/db/prcql.go Outdated
Comment thread broker/pullslip/api/api_handler.go Outdated
Comment thread broker/pullslip/api/api_handler_test.go Outdated
Comment thread broker/patron_request/db/prcql.go
@jakub-id jakub-id merged commit 537082a into main May 27, 2026
4 checks passed
@jakub-id jakub-id deleted the pass-pgcql-query-for-patron-requests branch May 27, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants