Internal note CROSSLINK-281#610
Open
skomorokh wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a staff-only internal_note field to patron requests, making it persistable in Postgres, filterable via CQL (has_internal_note), surfaced in the Patron Requests API, and updateable via a dedicated endpoint with corresponding Okapi permission wiring.
Changes:
- Extend
patron_requestschema + search view withinternal_noteand computedhas_internal_note, including forward/backward migrations. - Add API support: expose
internalNoteon patron requests and introducePUT /patron_requests/{id}/internal_noteto set/clear it. - Update CQL + repository plumbing and add tests covering filtering, API mapping, and the new endpoint.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/db/prrepo_test.go | Adds DB-level test coverage for has_internal_note filtering and round-tripping note values. |
| broker/sqlc/pr_schema.sql | Adds internal_note column and has_internal_note computed field to the search view for SQLC schema. |
| broker/sqlc/pr_query.sql | Updates Create/Update queries to include internal_note and adds a dedicated internal-note update query. |
| broker/patron_request/db/prrepo.go | Extends repo interface and implementation with UpdatePatronRequestInternalNote; maps search-view internal note back onto PatronRequest. |
| broker/patron_request/db/prcql.go | Adds CQL field definition for has_internal_note and updates manual scan order for the search view. |
| broker/patron_request/api/api-handler.go | Implements PUT /patron_requests/{id}/internal_note and exposes internalNote in API responses and create flow. |
| broker/patron_request/api/api-handler_test.go | Adds unit tests for internal note API mapping and the new endpoint behavior (set/clear/missing field/not found). |
| broker/oapi/open-api.yaml | Documents internalNote, adds UpdateInternalNote schema, adds new PUT /patron_requests/{id}/internal_note path, and lists has_internal_note as a CQL field. |
| broker/migrations/038_add_internal_note.up.sql | Adds internal_note column and recreates patron_request_search_view with has_internal_note. |
| broker/migrations/038_add_internal_note.down.sql | Drops/recreates view and removes internal_note column to roll back. |
| broker/descriptors/ModuleDescriptor-template.json | Adds Okapi routing and permission for the new internal note update endpoint. |
Comment on lines
+445
to
+448
| // Non-contractual guard | ||
| if trimmed := strings.TrimSpace(*notePtr); trimmed != "" { | ||
| note = pgtype.Text{Valid: true, String: trimmed} | ||
| } |
Comment on lines
+57
to
+62
| -- name: UpdatePatronRequestInternalNote :exec | ||
| UPDATE patron_request | ||
| SET internal_note = $2, | ||
| updated_at = now() | ||
| WHERE id = $1; | ||
|
|
Comment on lines
+1811
to
+1816
| requestBody: | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/UpdateInternalNote' | ||
| responses: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.