fix: 修正 middleware 导入路径、清理 catalog 冗余项、同步文档

This commit is contained in:
2026-03-05 11:22:49 +08:00
parent 02bdfffe79
commit 04b8dedb3e
5 changed files with 5 additions and 12 deletions

View File

@@ -275,4 +275,5 @@ export const env = createEnv({
- Use RQBv1 callback-style `orderBy` / old `relations()` API
- Use `drizzle-orm/bun-sql` driver (use `drizzle-orm/postgres-js`)
- Pass `schema` to `drizzle()` constructor (only `relations` is needed in RQBv2)
- Import `os` from `@orpc/server` in middleware — use `@/server/api/server` (the local typed instance)
- Leave docs out of sync with code changes

View File

@@ -11,6 +11,7 @@ export const handleValidationError = (error: unknown) => {
error.code === 'BAD_REQUEST' &&
error.cause instanceof ValidationError
) {
// If you only use Zod you can safely cast to ZodIssue[] (per ORPC official docs)
const zodError = new z.ZodError(error.cause.issues as z.core.$ZodIssue[])
throw new ORPCError('INPUT_VALIDATION_FAILED', {

View File

@@ -1,4 +1,4 @@
import { os } from '@orpc/server'
import { os } from '@/server/api/server'
import { getDB } from '@/server/db'
export const db = os.middleware(async ({ context, next }) => {