feat: add contact page with form handling and validation

- Implemented a contact page with a form for user inquiries.
- Added validation for form fields using Zod schema.
- Integrated PostgreSQL database for storing contact messages.
- Created necessary API endpoints for form submission.
- Added admin authentication and session management.
- Developed CGU, cookies policy, privacy policy, and legal mentions pages.
- Set up Docker configuration for PostgreSQL and application services.
- Enhanced UI with responsive design and accessibility features.
This commit is contained in:
Puechberty Arthur
2026-04-01 19:21:21 +02:00
parent 50553d5e92
commit f63eeb2e84
36 changed files with 2267 additions and 155 deletions
+26
View File
@@ -0,0 +1,26 @@
import { NextResponse } from "next/server";
import { isAdminAuthenticated } from "@/lib/admin-auth";
import { deleteMessage } from "@/lib/db";
export async function DELETE(
_request: Request,
context: { params: Promise<{ id: string }> },
) {
const authenticated = await isAdminAuthenticated();
if (!authenticated) {
return NextResponse.json({ message: "Unauthorized" }, { status: 401 });
}
const { id } = await context.params;
const messageId = Number(id);
if (!Number.isInteger(messageId) || messageId <= 0) {
return NextResponse.json({ message: "ID invalide." }, { status: 400 });
}
const deleted = await deleteMessage(messageId);
if (!deleted) {
return NextResponse.json({ message: "Message introuvable." }, { status: 404 });
}
return NextResponse.json({ ok: true });
}