Modernize the API runtime with Prisma 7 and automated updates#15
Merged
Modernize the API runtime with Prisma 7 and automated updates#15
Conversation
Member
|
Working on it, fixing the gaps. |
- Remove unnecessary 'as const' assertion from mode: 'insensitive' in contains() - Strip null bytes from search input before passing to plainto_tsquery - Refactor search SQL to use a CTE so plainto_tsquery is evaluated once - Move seed destructiveness warning to step 4 where db:seed is first introduced
String(q) avoids calling .replace() on an any-typed value from req.validatedQuery, satisfying @typescript-eslint/no-unsafe-call which is enabled via recommendedTypeChecked but was not disabled in eslint.config.js.
…ibility The 'as const' assertion is required so TypeScript narrows the string literal to the QueryMode union expected by Prisma's StringNullableFilter. Without it, mode is typed as plain 'string' which is not assignable.
AnoRebel
approved these changes
Mar 16, 2026
Member
AnoRebel
left a comment
There was a problem hiding this comment.
Code review complete — all issues resolved, CI green.
Review findings:
- SQL injection concern was a false positive — Prisma.sql tagged templates auto-parameterize all interpolated values
- Tests already cover /v1 and /api paths, collection filters, search with special chars, compatibility headers, and Prisma singleton behavior
Fixes applied (3 commits):
- Search query hardening: null-byte stripping + CTE refactor so plainto_tsquery runs once
- ESLint no-unsafe-call fix: wrapped q with String() before .replace()
- Restored
as conston mode: 'insensitive' for Prisma QueryMode type compatibility
Local verification: lint ✅ typecheck ✅ 20/20 tests ✅
CI verification: Node 20.19.0 ✅ Node 22 ✅
Contributor
Author
|
@AnoRebel thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@prisma/adapter-pg, and a single shared Prisma runtime/v1and/api, while cleaning up routes, request validation, search safety, logging, and cache behaviorKey Changes
>=20.19.0, ESM, modern TypeScript config, flat ESLint config, and updated package scriptssrc/db/prisma.tsprisma-clientoutput undersrc/generated/prismasearch_vectortrigger-backed full-text index supportprisma/seed.tsso tests and CI do not depend on an external pre-populated database$queryRawUnsafe/v1and/api, keeping/v1canonical and/apias a compatibility aliascountryId,regionCode,districtCode, andwardCode.github/workflows/ci.ymland.github/dependabot.ymlValidation
pnpm build:cipnpm buildpnpm openapi:jsonDATABASE_URL=postgresql://postgres@localhost:5432/locations_api NODE_ENV=test pnpm test:ciNotes
{ data },{ data, pagination }, and{ error }/v1is the canonical base path going forward, but/apiremains available for compatibility20.19.0+minimum and the Prisma 7 ESM client generation flow