From 15e557d0b877d476cc314059731b5c1b8abc02ee Mon Sep 17 00:00:00 2001 From: UltraLionFr Date: Wed, 20 Aug 2025 18:26:27 +0200 Subject: [PATCH] update user-pastes --- app/api/user-pastes/route.ts | 8 +++----- tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/api/user-pastes/route.ts b/app/api/user-pastes/route.ts index e2accb1..7b6b84a 100644 --- a/app/api/user-pastes/route.ts +++ b/app/api/user-pastes/route.ts @@ -1,6 +1,5 @@ import { authOptions } from '@/lib/auth'; import { prisma } from '@/lib/prisma'; -import { Prisma } from '@prisma/client'; import { getServerSession } from 'next-auth'; import { NextResponse } from 'next/server'; @@ -18,14 +17,13 @@ export async function GET(req: Request) { const search = searchParams.get('q') || ''; - // ✅ Typage explicite avec Prisma - const filter: Prisma.PasteWhereInput = { + const filter = { createdBy: session.user.id, ...(search ? { title: { contains: search, - mode: 'insensitive', // correspond au type Prisma.QueryMode + mode: 'insensitive', }, } : {}), @@ -44,4 +42,4 @@ export async function GET(req: Request) { ]); return NextResponse.json({ pastes, total }); -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 4302a03..82f22ec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "module": "esnext", - "moduleResolution": "node", // ✅ change "bundler" en "node" + "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true,