Skip to content

feat(backend): add Sequelize database adapter - #40

Open
saad-gsoft wants to merge 5 commits into
mainfrom
db/sequelize
Open

feat(backend): add Sequelize database adapter#40
saad-gsoft wants to merge 5 commits into
mainfrom
db/sequelize

Conversation

@saad-gsoft

Copy link
Copy Markdown
Contributor

Summary

  • Adds complete Sequelize adapter implementing the database-agnostic repository pattern from main
  • SequelizeBaseRepository with full CRUD, pagination, count(), clearAll()
  • UserRepository with isEmailTaken() and password field stripping
  • User/Token models with UUID primary keys and Sequelize hooks for password hashing
  • SQLite in-memory for fast test execution, PostgreSQL for production
  • Configures PostgreSQL in Docker Compose and GitHub Actions CI
  • Sets DB_ADAPTER=sequelize and DATABASE_URL in env files

Test plan

  • All 185 tests pass with SQLite in-memory
  • CI pipeline runs tests with SQLite
  • Verify Docker Compose brings up PostgreSQL plus app together

Generated with Claude Code

Add complete Sequelize adapter implementing the repository pattern:
- SequelizeBaseRepository with CRUD, pagination, count, clearAll
- UserRepository with isEmailTaken and password stripping
- TokenRepository
- SQLite in-memory for tests, PostgreSQL for production
- User/Token model definitions with UUID primary keys
- Password hashing via Sequelize beforeCreate/beforeUpdate hooks
- Configure PostgreSQL in Docker and CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
saad-gsoft and others added 3 commits March 30, 2026 21:53
… pattern

- Call connect() from repository adapter before starting workers/listening
- Disconnect on shutdown/SIGTERM for clean process exit
- Update README to reflect database-agnostic architecture (PostgreSQL default,
  MongoDB supported) instead of MongoDB-first language
- Document DB_ADAPTER and DATABASE_URL env vars
- Remove obsolete Mongoose Plugins section (now handled by repository layer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@saad-gsoft

Copy link
Copy Markdown
Contributor Author

Fixes Applied

1. DB connection at startup

connect() from the repository adapter was only called in test setup. Added to index.js before startWorkers() and listen(). Added disconnect() on shutdown/SIGTERM.

2. Documentation updated

README.md updated to reflect database-agnostic architecture:

  • Replaced MongoDB-first language with adapter-pattern language (PostgreSQL default, MongoDB supported)
  • Documented DB_ADAPTER and DATABASE_URL env vars
  • Removed obsolete "Mongoose Plugins" section
  • Updated Docker, CI, and tech stack sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions Bot added the stale label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant