Skip to content

Internal note CROSSLINK-281#610

Open
skomorokh wants to merge 1 commit into
mainfrom
internal-note-crosslink-281
Open

Internal note CROSSLINK-281#610
skomorokh wants to merge 1 commit into
mainfrom
internal-note-crosslink-281

Conversation

@skomorokh
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 22, 2026 20:34
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

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_request schema + search view with internal_note and computed has_internal_note, including forward/backward migrations.
  • Add API support: expose internalNote on patron requests and introduce PUT /patron_requests/{id}/internal_note to 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 thread broker/sqlc/pr_query.sql
Comment on lines +57 to +62
-- name: UpdatePatronRequestInternalNote :exec
UPDATE patron_request
SET internal_note = $2,
updated_at = now()
WHERE id = $1;

Comment thread broker/oapi/open-api.yaml
Comment on lines +1811 to +1816
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateInternalNote'
responses:
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.

2 participants