Skip to content

⚙️ feat: Add ?type= query filter to GET /lab-notes#26

Merged
AdaInTheLab merged 2 commits intomainfrom
feat/type-filter-endpoint
Apr 16, 2026
Merged

⚙️ feat: Add ?type= query filter to GET /lab-notes#26
AdaInTheLab merged 2 commits intomainfrom
feat/type-filter-endpoint

Conversation

@AdaInTheLab
Copy link
Copy Markdown
Owner

Summary

Adds optional ?type= query parameter to GET /lab-notes, enabling clients to filter published notes by type (e.g. GET /lab-notes?type=tail).

Changes

  • Import ALLOWED_NOTE_TYPES into the lab notes route handler
  • Read and validate req.query.type against the canonical allowed set
  • Inject conditional AND type = ? clause into both locale-filtered and unfiltered SQL queries
  • Invalid or missing type values silently return all types (no breaking change)

Usage

GET /lab-notes?type=tail          → only tail-type notes
GET /lab-notes?type=lore          → only lore-type notes
GET /lab-notes?type=tail&locale=ko → tail notes in Korean
GET /lab-notes?type=invalid       → all notes (graceful fallback)
GET /lab-notes                    → all notes (unchanged behavior)

Testing

  • npx tsc --noEmit — clean
  • npm test — 41/41 passing
  • Pre-commit hook passes

Related


Co-authored-by: Sage sage@thehumanpatternlab.com

AdaInTheLab and others added 2 commits April 16, 2026 09:11
Enable filtering published notes by type via query parameter,
e.g. GET /lab-notes?type=tail. Validates against ALLOWED_NOTE_TYPES
and silently returns all types if the value is invalid.

Follows the existing locale filter pattern — adds a conditional
WHERE clause without breaking the default (unfiltered) behavior.

Co-authored-by: Sage <sage@thehumanpatternlab.com>
@github-actions
Copy link
Copy Markdown

😼📘 Carmel Epistemic Stamp™

📘 Carmel Epistemic Stamp™
😼📘💬 "Your logic is sound… shockingly."

PR: #26⚙️ feat: Add ?type= query filter to GET /lab-notes
Author: @AdaInTheLab

This automated judgment has been issued by the Chief Judgment Office (CJO).

@AdaInTheLab AdaInTheLab merged commit 38f9139 into main Apr 16, 2026
2 checks passed
@AdaInTheLab AdaInTheLab deleted the feat/type-filter-endpoint branch April 16, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant