Skip to content

refactor: move Sequelize query executor out of DAL into backend - #4325

Merged
skwowet merged 1 commit into
mainfrom
refactor/CM-1180-sequelize-qx
Jul 12, 2026
Merged

refactor: move Sequelize query executor out of DAL into backend#4325
skwowet merged 1 commit into
mainfrom
refactor/CM-1180-sequelize-qx

Conversation

@skwowet

@skwowet skwowet commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Moves the Sequelize-backed QueryExecutor bridge out of @crowd/data-access-layer and into the backend, where Sequelize actually lives. DAL keeps the shared QueryExecutor type and pg-promise re-exports only; backend callers import optionsQx from @/database/sequelizeQueryExecutor instead of the DAL barrel.

This is a structural cleanup, not a behavior change. No API routes, repository logic, or DAL query functions were refactored beyond the import path. DAL renames and test-kit work stay in follow-up PRs.

Long term, DAL should not depend on Sequelize at all. Workers and Vitest already use pgpQx; only the backend still runs on Sequelize repositories. Keeping the adapter in DAL forced a Sequelize devDependency on a shared package and made it easy for test imports to pull legacy ORM code unintentionally.

Changes

  • Add backend/src/database/sequelizeQueryExecutor.ts with SequelizeQueryExecutor, TransactionalSequelizeQueryExecutor, optionsQx, and optionsBgQx
  • Slim services/libs/data-access-layer/src/queryExecutor.ts to pg-promise re-exports and the QueryExecutor type only
  • Remove sequelize from @crowd/data-access-layer devDependencies
  • Rewire backend optionsQx / optionsBgQx imports across API handlers, services, scripts, and repositories to @/database/sequelizeQueryExecutor
  • Update pnpm-lock.yaml for the DAL sequelize removal

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Jul 12, 2026
Copilot AI review requested due to automatic review settings July 12, 2026 16:00
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Moves the legacy Sequelize QueryExecutor adapter from the shared DAL into the backend and rewires its consumers.

Changes:

  • Adds the backend-local Sequelize adapter.
  • Removes Sequelize from DAL dependencies.
  • Updates backend imports to use the new adapter location.

Review note: Unrelated AWS lockfile rewrites should be reverted. The PR title also lacks the required JIRA key.

Reviewed changes

Copilot reviewed 29 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/libs/data-access-layer/src/queryExecutor.ts Retains database re-exports only.
services/libs/data-access-layer/package.json Removes Sequelize dependency.
pnpm-lock.yaml Updates dependency graph.
backend/src/database/sequelizeQueryExecutor.ts Adds backend-local adapter.
backend/src/services/organizationService.ts Rewires adapter import.
backend/src/services/memberService.ts Rewires adapter imports.
backend/src/services/member/memberIdentityService.ts Rewires adapter import.
backend/src/database/repositories/sequelizeRepository.ts Uses local adapter classes.
backend/src/database/repositories/repositoryBase.ts Uses local adapter factory.
backend/src/database/repositories/organizationRepository.ts Rewires adapter import.
backend/src/database/repositories/memberRepository.ts Rewires adapter imports.
backend/src/bin/scripts/merge-similar-organizations.ts Rewires adapter import.
backend/src/bin/scripts/merge-members.ts Rewires adapter import.
backend/src/api/public/v1/organizations/getOrganization.ts Rewires adapter import.
backend/src/api/public/v1/organizations/createOrganization.ts Rewires adapter import.
backend/src/api/public/v1/members/work-experiences/verifyMemberWorkExperience.ts Rewires adapter import.
backend/src/api/public/v1/members/work-experiences/updateMemberWorkExperience.ts Rewires adapter import.
backend/src/api/public/v1/members/work-experiences/getMemberWorkExperiences.ts Rewires adapter import.
backend/src/api/public/v1/members/work-experiences/deleteMemberWorkExperience.ts Rewires adapter import.
backend/src/api/public/v1/members/work-experiences/createMemberWorkExperience.ts Rewires adapter import.
backend/src/api/public/v1/members/resolveMember.ts Rewires adapter import.
backend/src/api/public/v1/members/project-affiliations/patchProjectAffiliation.ts Rewires adapter import.
backend/src/api/public/v1/members/project-affiliations/getProjectAffiliations.ts Rewires adapter import.
backend/src/api/public/v1/members/maintainer-roles/getMemberMaintainerRoles.ts Rewires adapter import.
backend/src/api/public/v1/members/identities/verifyMemberIdentity.ts Rewires adapter import.
backend/src/api/public/v1/members/identities/getMemberIdentities.ts Rewires adapter import.
backend/src/api/public/v1/members/identities/createMemberIdentity.ts Rewires adapter import.
backend/src/api/public/v1/members/createMember.ts Rewires adapter import.
backend/src/api/public/v1/affiliations/getAffiliations.ts Rewires adapter import.
backend/src/api/public/v1/affiliations/getAffiliationByHandle.ts Rewires adapter import.
backend/src/api/public/middlewares/staticApiKeyMiddleware.ts Rewires adapter import.
backend/src/api/member/memberMerge.ts Rewires adapter import.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

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

Comment thread pnpm-lock.yaml
@skwowet
skwowet merged commit daa3c30 into main Jul 12, 2026
15 checks passed
@skwowet
skwowet deleted the refactor/CM-1180-sequelize-qx branch July 12, 2026 16:30
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.

2 participants