Skip to content

feat(api): persist notes, bookmarks, approvals, analytics to PostgreSQL#809

Open
zeemscript wants to merge 1 commit into
rinafcode:mainfrom
zeemscript:feat/749-persist-to-postgres
Open

feat(api): persist notes, bookmarks, approvals, analytics to PostgreSQL#809
zeemscript wants to merge 1 commit into
rinafcode:mainfrom
zeemscript:feat/749-persist-to-postgres

Conversation

@zeemscript

Copy link
Copy Markdown

Summary

  • Replace in-memory Map storage with PostgreSQL database persistence for notes, bookmarks, approvals, and video-analytics API routes
  • Add SQL migrations for 4 new tables: notes, bookmarks, content_approvals, video_events
  • Create repository layer with parameterized SQL queries for type-safe database operations

Changes

  • Migrations: 4 SQL files in src/lib/db/migrations/ defining table schemas with indexes
  • Repositories: 4 new repository modules in src/lib/db/repositories/ with CRUD operations
  • Route handlers: Updated to use repositories instead of Maps, removed edge runtime
  • Tests: Integration tests with mocked database queries for all 4 routes

Test plan

  • Run migrations against PostgreSQL database
  • Verify CRUD operations work for notes, bookmarks, approvals, analytics
  • Confirm data persists across server restarts
  • Run npx vitest run src/app/api/notes/__tests__ src/app/api/bookmarks/__tests__ src/app/api/approvals/__tests__ src/app/api/video-analytics/__tests__

Closes #749

Replaces in-memory Map storage with PostgreSQL database persistence
for the notes, bookmarks, approvals, and video-analytics API routes.

Changes:
- Add SQL migrations for notes, bookmarks, content_approvals, video_events tables
- Create repository layer with parameterized SQL queries
- Update route handlers to use repositories instead of Maps
- Remove edge runtime (using Node.js runtime for pg driver compatibility)
- Add integration tests with mocked database queries

Closes rinafcode#749
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@zeemscript Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great job so far

There’s are just two blockers — the workflow is failing and a mwerge conflict. Could you take a look and fix it so all checks pass?

Happy to review again once that’s done.
You can pull from the main first before pushing. The workflow should pass

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.

[Tech-debt] Notes, bookmarks, approvals, and video-analytics use in-memory Maps instead of a database

2 participants