update user-pastes

This commit is contained in:
UltraLionFr
2025-08-20 18:26:27 +02:00
parent 8b4355518e
commit 15e557d0b8
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -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 });
}
}