Skip to content

Add saved filter presets for authenticated users [AICC-68] - #59

Open
hoangsonww with Copilot wants to merge 5 commits into
masterfrom
copilot/add-saved-search-presets
Open

Add saved filter presets for authenticated users [AICC-68]#59
hoangsonww with Copilot wants to merge 5 commits into
masterfrom
copilot/add-saved-search-presets

Conversation

Copilot AI commented Nov 2, 2025

Copy link
Copy Markdown

Government staff need to save commonly used filter combinations (source, topic, date range) instead of manually reapplying them on each visit.

AICC-68

Backend

  • Model: FilterPreset schema with userId, name, filters (source/topic/dateRange), unique index on (userId, name)
  • Routes: /api/filters CRUD endpoints, all authenticated
  • Controller: Validates duplicates, enforces user isolation
  • Tests: 17 specs covering auth, validation, CRUD operations

Frontend

  • Component: SavedFilters dropdown with preset list, save/rename/delete modals
  • Integration: Added to home page search bar, applies filters on preset selection
  • Visibility: Renders only for authenticated users

API Usage

// Create preset
POST /api/filters
Authorization: <jwt-token>
{ "name": "State Dept Policy", "filters": { "source": "state.gov", "topic": "policy" } }

// Apply preset (client-side)
GET /api/filters  select preset  update query params

Presets persist per-user in MongoDB, not localStorage.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • ai-content-curator-backend.vercel.app
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/AI-Gov-Content-Curator/AI-Gov-Content-Curator/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)
  • fastdl.mongodb.org
    • Triggering command: node ./postinstall.js (dns block)
  • scarf.sh
    • Triggering command: node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Saved Search & Filter Presets for Articles</issue_title>
<issue_description>Description
Add the ability for users to save their commonly used filters (e.g., source, date range, topic tags) as presets. This would make it easier for government staff to quickly return to frequently used queries without manually reapplying filters each time.

Why
Currently, users can filter and search articles, but they must reapply filters on every visit. Saved search presets would streamline workflows, improve efficiency, and make the system feel more personalized.

Acceptance Criteria

  • Users can apply filters (e.g., source = “state.gov”, topic = “policy”) and save them as a named preset.
  • Presets should be visible under a “Saved Filters” dropdown on the article listing page.
  • Users can rename or delete existing presets.
  • Presets are stored per user account and synced via backend (not local storage).
  • Frontend must update dynamically when a saved preset is applied.

Technical Notes

  • Extend backend API with a /api/filters endpoint to handle CRUD operations for saved presets.
  • Store presets in MongoDB with references to the authenticated user.
  • Frontend (Next.js) should implement a simple UI dropdown + management modal for presets.
  • Consider caching recently used presets with Redis for faster retrieval.</issue_description>

Comments on the Issue (you are @copilot in this section)

@hoangsonww todo for now

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Nov 2, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ai-gov-content-curator Ready Ready Preview Comment Nov 2, 2025 9:40pm

@hoangsonww hoangsonww added bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request frontend Frontend Next.js edits backend Backend Node.js Express.js edits crawler Crawler changes ci/cd GitHub Actions CI/CD changes deployment Vercel or AWS deployment settings labels Nov 2, 2025
@hoangsonww hoangsonww added this to the v1.x.x - Public Stable Beta milestone Nov 2, 2025
@hoangsonww
hoangsonww requested a review from Copilot November 2, 2025 21:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
@hoangsonww hoangsonww changed the title [WIP] Add saved search and filter presets for articles [WIP] Add saved search and filter presets for articles [AICC-68] Nov 2, 2025
@hoangsonww

hoangsonww commented Nov 2, 2025

Copy link
Copy Markdown
Owner

AICC-68

@hoangsonww
hoangsonww marked this pull request as ready for review November 2, 2025 21:35
…tion

Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
@hoangsonww hoangsonww changed the title [WIP] Add saved search and filter presets for articles [AICC-68] Add saved search and filter presets for articles [AICC-68] Nov 2, 2025
Co-authored-by: hoangsonww <124531104+hoangsonww@users.noreply.github.com>
Copilot AI changed the title Add saved search and filter presets for articles [AICC-68] Add saved filter presets for authenticated users Nov 2, 2025
Copilot AI requested a review from hoangsonww November 2, 2025 21:41
@hoangsonww hoangsonww changed the title Add saved filter presets for authenticated users Add saved filter presets for authenticated users [AICC-68] Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Node.js Express.js edits bug Something isn't working ci/cd GitHub Actions CI/CD changes crawler Crawler changes deployment Vercel or AWS deployment settings duplicate This issue or pull request already exists enhancement New feature or request frontend Frontend Next.js edits

Development

Successfully merging this pull request may close these issues.

Saved Search & Filter Presets for Articles

3 participants