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:
2025-11-23 10:07:34 +01:00
parent 51a74342f4
commit 115d8c05a7
83 changed files with 1143 additions and 679 deletions

View File

@ -1,55 +0,0 @@
import { NextResponse } from "next/server";
import { updateClient, deleteClient, loadClients } from "@/lib/admin/client-utils";
import { requireAdminAuth } from "@/lib/admin/auth";
import { ClientInput } from "@/lib/types/client";
export async function PUT(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
if (!requireAdminAuth(request)) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
try {
const { id } = await params;
const body: Partial<ClientInput> = await request.json();
const client = updateClient(id, body);
if (!client) {
return NextResponse.json(
{ error: "Client non trouvé" },
{ status: 404 }
);
}
return NextResponse.json(client);
} catch (error: any) {
return NextResponse.json(
{ error: error.message || "Erreur lors de la mise à jour" },
{ status: 400 }
);
}
}
export async function DELETE(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
if (!requireAdminAuth(request)) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
const { id } = await params;
const deleted = deleteClient(id);
if (!deleted) {
return NextResponse.json(
{ error: "Client non trouvé" },
{ status: 404 }
);
}
return NextResponse.json({ success: true });
}

View File

@ -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 }
);
}
}