update user-pastes
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { authOptions } from '@/lib/auth';
|
import { authOptions } from '@/lib/auth';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
import { Prisma } from '@prisma/client';
|
|
||||||
import { getServerSession } from 'next-auth';
|
import { getServerSession } from 'next-auth';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
@@ -18,14 +17,13 @@ export async function GET(req: Request) {
|
|||||||
|
|
||||||
const search = searchParams.get('q') || '';
|
const search = searchParams.get('q') || '';
|
||||||
|
|
||||||
// ✅ Typage explicite avec Prisma
|
const filter = {
|
||||||
const filter: Prisma.PasteWhereInput = {
|
|
||||||
createdBy: session.user.id,
|
createdBy: session.user.id,
|
||||||
...(search
|
...(search
|
||||||
? {
|
? {
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
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 });
|
return NextResponse.json({ pastes, total });
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node", // ✅ change "bundler" en "node"
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user