-
Notifications
You must be signed in to change notification settings - Fork 71
feature remove typeorm and fix prisma.ts #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughRemoved TypeORM configuration and initialization from src/config/data-source.ts. Updated Prisma packages in package.json and removed reflect-metadata and typeorm dependencies. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as Application
participant DB as Database
participant ORM as TypeORM DataSource
rect rgba(200,230,255,0.3)
note over App,ORM: Previous flow
User->>App: Start app
App->>ORM: Initialize DataSource
ORM-->>App: Initialization result (success/failure)
App->>DB: Queries via ORM
end
rect rgba(230,255,230,0.3)
note over App,DB: New flow (after change)
User->>App: Start app
App-x ORM: No initialization (removed)
App-->>DB: Future data access via alternative (e.g., Prisma)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
package.json (2)
6-23: Automate Prisma client generation to avoid “Cannot find module '@prisma/client'”.Add a postinstall and an explicit script so fresh installs and CI consistently generate the client.
"scripts": { + "prisma:generate": "prisma generate", + "postinstall": "prisma generate", "test:dto": "jest --runInBand src/modules/auth/__tests__/dto --detectOpenHandles", "test:dto:independent": "jest --runInBand src/modules/auth/__tests__/dto --detectOpenHandles", "dev": "ts-node-dev src/index.ts", "build": "tsc",
13-14: Remove leftover TypeORM usage and refactor DB test scripts for Prisma
- tests//*.test.ts still import and use AppDataSource (TypeORM) and entity classes under src/modules//domain/entities – migrate or delete these before dropping TypeORM.
- package.json “test:sqlite”/“test:postgres” should set DATABASE_URL and run
prisma migrate deploy(orprisma db push) instead of toggling DB_TYPE (see package.json:13-14).- Ensure any test bootstrap (e.g. scripts/test-all-endpoints.ts) invokes Prisma migrations against both SQLite and Postgres before running Jest.
🧹 Nitpick comments (1)
package.json (1)
1-5: Declare Node engine to match Prisma 6 requirements.Add an engines field so CI/CD and package managers enforce a compatible Node version (e.g., 18 LTS+).
{ "name": "volunchain-backend", "version": "1.0.0", "type": "commonjs", "main": "dist/index.js", + "engines": { + "node": ">=18.18 <23" + },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.json(2 hunks)src/config/data-source.ts(0 hunks)
💤 Files with no reviewable changes (1)
- src/config/data-source.ts
| "@aws-sdk/client-s3": "^3.798.0", | ||
| "@aws-sdk/s3-request-presigner": "^3.798.0", | ||
| "@prisma/client": "^6.4.1", | ||
| "@prisma/client": "^6.15.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Pin @prisma/client to the exact version to prevent runtime mismatches.
Using a caret can desync the runtime client from the CLI at deploy time. Prisma recommends keeping CLI and client in lockstep. Pin it to the same exact version as devDependency "prisma".
- "@prisma/client": "^6.15.0",
+ "@prisma/client": "6.15.0",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "@prisma/client": "^6.15.0", | |
| "@prisma/client": "6.15.0", |
🤖 Prompt for AI Agents
In package.json around line 27, the @prisma/client dependency is using a careted
range ("^6.15.0") which can cause runtime/client CLI version drift; change it to
the exact version ("6.15.0") to pin it, and make sure this exact version matches
the devDependency "prisma" entry; after updating package.json run your package
manager (npm/yarn/pnpm) to refresh the lockfile so the runtime client and CLI
remain in lockstep.
| "lint-staged": "^15.4.3", | ||
| "prettier": "^3.4.2", | ||
| "prisma": "^6.4.1", | ||
| "prisma": "^6.15.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Pin prisma CLI to match the client version.
Keep CLI and client aligned to avoid “version mismatch” errors and accidental minor upgrades in CI/CD.
- "prisma": "^6.15.0",
+ "prisma": "6.15.0",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "prisma": "^6.15.0", | |
| "prisma": "6.15.0", |
🤖 Prompt for AI Agents
In package.json around line 81, the Prisma CLI dependency is using a caret
("^6.15.0") which allows minor/patch upgrades and can cause version mismatch
with the client; replace the careted version with the exact pinned version
"6.15.0" for the prisma dependency, then regenerate the lockfile (run npm/yarn
install) and commit the updated lockfile to ensure CI uses the exact CLI version
that matches the client.
🚀 Volunchain Pull Request
Mark with an
xall the checkboxes that apply (like[x])📌 Type of Change
📝 Changes description
Fixed Prisma client import error by running
npx prisma generateto properly generate the Prisma client after schema changes. This resolves the "Cannot find module '@prisma/client'" error that was preventing the application from running.The issue occurred because while
@prisma/clientwas listed in package.json dependencies, the actual generated client code wasn't present in node_modules. Prisma requires a generation step after schema changes to create the necessary TypeScript types and runtime code.📸 Evidence (A photo is required as evidence)
[Attach a screenshot showing the successful Prisma client generation output]
⏰ Time spent breakdown
npx prisma generate: 2 minutes�� Comments
This was a straightforward fix that involved regenerating the Prisma client. The error was preventing the application from starting due to missing generated Prisma client code. After running the generate command, the import error was resolved and the application should now run properly.
The fix ensures that the Prisma client is properly generated and available for import, maintaining the existing database configuration and connection pooling setup.
Thank you for contributing to Volunchain, we are glad that you have chosen us as your project of choice and we hope that you continue to contribute to this great project, so that together we can make our mark at the top!
Summary by CodeRabbit
Chores
Refactor
Notes