mise a jour next 16 et user

This commit is contained in:
Biqoz
2025-12-15 13:23:49 +01:00
parent 1a590d60c3
commit fff81fda4f
7 changed files with 658 additions and 177 deletions

View File

@@ -13,7 +13,8 @@
"Bash(node update-referent.js:*)",
"Bash(node:*)",
"Bash(curl:*)",
"Bash(npx tsc:*)"
"Bash(npx tsc:*)",
"WebSearch"
],
"deny": [],
"ask": []

View File

@@ -133,6 +133,13 @@ export async function GET(
}
}
// Gestion spéciale pour balances - le champ user est stocké comme ObjectId
if (collection === "balances") {
if (filter.user && typeof filter.user === "string" && ObjectId.isValid(filter.user)) {
filter.user = new ObjectId(filter.user);
}
}
const db = await getDatabase();
const skip = (page - 1) * limit;

View File

@@ -71,9 +71,10 @@ export default function AddCreditsSingleUser() {
setLoadingBalance(true);
try {
// Récupérer la balance de l'utilisateur
// Récupérer la balance de l'utilisateur avec un filtre exact sur le champ "user"
const filter = encodeURIComponent(JSON.stringify({ user: user._id }));
const response = await fetch(
`/api/collections/balances?search=${user._id}&limit=1`
`/api/collections/balances?filter=${filter}&limit=1`
);
const data = await response.json();

788
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,7 @@
"dotenv": "^17.2.3",
"lucide-react": "^0.544.0",
"mongodb": "^6.20.0",
"next": "15.5.4",
"next": "16.0.10",
"react": "19.1.0",
"react-dom": "19.1.0",
"recharts": "^3.2.1",
@@ -44,7 +44,7 @@
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.5.4",
"eslint-config-next": "16.0.10",
"tailwindcss": "^4",
"tw-animate-css": "^1.4.0",
"typescript": "^5"

View File

@@ -1,7 +1,7 @@
import { createServerClient } from '@supabase/ssr'
import { NextResponse, type NextRequest } from 'next/server'
export async function middleware(request: NextRequest) {
export async function proxy(request: NextRequest) {
let supabaseResponse = NextResponse.next({
request,
})
@@ -62,4 +62,4 @@ export const config = {
*/
'/((?!_next/static|_next/image|favicon.ico|public|img).*)',
],
}
}

View File

@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -11,7 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
@@ -19,9 +23,19 @@
}
],
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}