Build APK Android fonctionnel - Corrections finales
- Ajout de Java 21 dans Dockerfile pour compatibilité Capacitor - Création de fichiers de types séparés (lib/types/) pour éviter dépendances API routes - Configuration next.config.export.js pour export statique - Exclusion temporaire des routes API pendant le build - Correction configuration Gradle (Java 17/21) - Script build-apk.sh amélioré avec gestion des routes API - APK généré avec succès (4.5MB) dans dist/compagnon-admin-debug.apk Fichiers de types créés: - lib/types/place.ts - lib/types/infos.ts - lib/types/tides.ts - lib/types/excursions.ts - lib/types/sun-times.ts - lib/types/notifications.ts Tous les imports mis à jour pour utiliser les nouveaux fichiers de types.
This commit is contained in:
@ -1,60 +0,0 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import {
|
||||
createClient,
|
||||
loadClients,
|
||||
updateClient,
|
||||
deleteClient,
|
||||
validateEmail,
|
||||
} from "@/lib/admin/client-utils";
|
||||
import { requireAdminAuth } from "@/lib/admin/auth";
|
||||
import { ClientInput } from "@/lib/types/client";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
if (!requireAdminAuth(request)) {
|
||||
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
|
||||
}
|
||||
|
||||
const clients = loadClients();
|
||||
return NextResponse.json(clients);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
if (!requireAdminAuth(request)) {
|
||||
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
|
||||
}
|
||||
|
||||
try {
|
||||
const body: ClientInput = await request.json();
|
||||
|
||||
// Validation
|
||||
if (!body.email || !validateEmail(body.email)) {
|
||||
return NextResponse.json(
|
||||
{ error: "Email invalide" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
if (!body.bungalowNumber) {
|
||||
return NextResponse.json(
|
||||
{ error: "Numéro de bungalow requis" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const client = createClient({
|
||||
email: body.email,
|
||||
bungalowNumber: body.bungalowNumber,
|
||||
wifiName: body.wifiName || "Lagon-WiFi",
|
||||
wifiPassword: body.wifiPassword || "",
|
||||
gerantMessage: body.gerantMessage || "Bienvenue dans notre pension de famille !",
|
||||
});
|
||||
|
||||
return NextResponse.json(client, { status: 201 });
|
||||
} catch (error: any) {
|
||||
return NextResponse.json(
|
||||
{ error: error.message || "Erreur lors de la création du client" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user