src/app/api/mobile/check-user/route.ts
Annotation non disponible
Lance npm run annotate (nécessite ANTHROPIC_API_KEY dans .env.local) pour générer une annotation française par Claude Haiku 4.5.
Concepts détectés — comprends la théorie
Route API Next.js
3 occurrencesCe fichier est une route API Next.js (App Router). Voir le contrat API complet pour les conventions de réponse et d'auth.
Voir l'article général
ORM Prisma
2 occurrencesCe fichier accède à la base de données via Prisma. Prisma est l'ORM utilisé côté backend pour les requêtes typées sur PostgreSQL.
Voir l'article général
1 export
GET
Code source· typescript
import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/prisma/client";
export async function GET(req: NextRequest) {
const { searchParams } = new URL(req.url);
const identifier = searchParams.get("identifier")?.trim().toLowerCase();
const identifierType = searchParams.get("identifierType");
if (!identifier || !identifierType) {
return NextResponse.json({ error: "Paramètres manquants" }, { status: 400 });
}
if (!["phone", "email"].includes(identifierType)) {
return NextResponse.json({ error: "identifierType invalide" }, { status: 400 });
}
const client = await prisma.clientAccount.findFirst({
where: identifierType === "email" ? { email: identifier } : { phone: identifier },
select: { id: true, prenom: true, name: true },
});
return NextResponse.json({
exists: !!client,
prenom: client?.prenom ?? client?.name ?? null,
});
}
import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/prisma/client";
export async function GET(req: NextRequest) {
const { searchParams } = new URL(req.url);
const identifier = searchParams.get("identifier")?.trim().toLowerCase();
const identifierType = searchParams.get("identifierType");
if (!identifier || !identifierType) {
return NextResponse.json({ error: "Paramètres manquants" }, { status: 400 });
}
if (!["phone", "email"].includes(identifierType)) {
return NextResponse.json({ error: "identifierType invalide" }, { status: 400 });
}
const client = await prisma.clientAccount.findFirst({
where: identifierType === "email" ? { email: identifier } : { phone: identifier },
select: { id: true, prenom: true, name: true },
});
return NextResponse.json({
exists: !!client,
prenom: client?.prenom ?? client?.name ?? null,
});
}