Skip to content

Commit

Permalink
Merge pull request #152 from osstotalsoft/bugfix/fix-tenanct-cache-typo
Browse files Browse the repository at this point in the history
fix prisma tenant cache typo + lint script
  • Loading branch information
alexandra-c authored Jan 20, 2025
2 parents 5694462 + 9886712 commit 72c1aab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion generators/app/templates/infrastructure/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable node/no-unpublished-require */
const { fixupConfigRules } = require('@eslint/compat'),
js = require('@eslint/js'),
{ FlatCompat } = require('@eslint/eslintrc')
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:watchAll": "npm run test -- --watchAll",
"test:watch": "npm run test -- --watch",
"test:ci": "cross-env CI=true npm test -- --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageReporters=lcov --coverageReporters=html",
"lint": "eslint --fix --ext .js .",
"lint": "eslint .",
"prettier": "prettier --write **/*.{js,jsx,ts,tsx,css,md,json}",
"prepack": "husky install",
"prisma": "npx prisma db pull && npm run prisma:format && npx prisma generate",
Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/infrastructure/src/prisma/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function prisma() {
prismaClient = tenantFilterExtension(prismaClient, tenantId)
cacheMap.set(tenantId, prismaClient)
<%_} else { _%>
const connectionInfo = tenantConfiguration.getConnectionInfo(id, '<%= dbConnectionName %>')
const connectionInfo = tenantConfiguration.getConnectionInfo(tenantId, '<%= dbConnectionName %>')
const { server, port, database, userName, password } = sanitizeConnectionInfo(connectionInfo)
const url = PRISMA_DB_URL_PATTERN.replace('{server}', server)
.replace('{port}', port)
Expand All @@ -40,7 +40,7 @@ function prisma() {
.replace('{password}', password)

prismaClient = new PrismaClient({ ...prismaOptions, datasources: { db: { url } } })
cacheMap.set(id, prismaClient)
cacheMap.set(tenantId, prismaClient)
<%_}_%>
} else {
if (cacheMap.has('default')) return cacheMap.get('default')
Expand Down

0 comments on commit 72c1aab

Please sign in to comment.