Skip to content

Always set requester req#435

Merged
jakub-id merged 2 commits intomainfrom
set-requester-req-id
Mar 5, 2026
Merged

Always set requester req#435
jakub-id merged 2 commits intomainfrom
set-requester-req-id

Conversation

@jakub-id
Copy link
Contributor

@jakub-id jakub-id commented Mar 5, 2026

refactor a bit to ensure we're always reading from the right side

refactor a bit to ensure we're always reading from the right side
Copilot AI review requested due to automatic review settings March 5, 2026 13:21
Copy link
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 lookups and creation to ensure the code consistently reads/links requests from the correct “side” (borrowing vs lending), and to always populate requester_req_id for borrowing-side requests.

Changes:

  • Ensure newly created borrowing patron requests always set RequesterReqID and do not persist SupplierSymbol.
  • Add side-aware repository lookup (GetPatronRequestByIdAndSide) and restrict supplierSymbol/requesterReqId lookups to lending-side rows.
  • Update message-handler, repo SQL, and related tests to use the new side-safe methods.

Reviewed changes

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

Show a summary per file
File Description
broker/test/patron_request/api/api-handler_test.go Updates integration tests to reflect borrowing requests no longer returning supplierSymbol, and uses the explicit supplier symbol when querying lending-side actions.
broker/sqlc/pr_query.sql Renames the supplierSymbol/requesterReqId query and adds side = 'lending' filtering to avoid returning borrowing-side rows.
broker/patron_request/service/message-handler_test.go Updates mocks/expectations to use GetPatronRequestByIdAndSide and the lending-only supplierSymbol/requesterReqId lookup.
broker/patron_request/service/message-handler.go Switches message-to-request resolution to side-aware lookups and lending-only supplierSymbol/requesterReqId lookup.
broker/patron_request/service/action_test.go Extends the shared test mock repo to implement the new repo method(s) and renamed lookup.
broker/patron_request/db/prrepo.go Adds GetPatronRequestByIdAndSide and renames/rewires the lending-only supplierSymbol/requesterReqId lookup.
broker/patron_request/api/api-handler_test.go Extends unit tests to assert RequesterReqID is set and SupplierSymbol is unset for borrowing-side creation.
broker/patron_request/api/api-handler.go Sets RequesterReqID on creation and forces borrowing-side SupplierSymbol to NULL.
broker/client/client_test.go Updates the client-side test mock to satisfy the updated repo interface usage.

@jakub-id jakub-id merged commit f845ce1 into main Mar 5, 2026
5 checks passed
@jakub-id jakub-id deleted the set-requester-req-id branch March 5, 2026 20:06
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