Initial commit — Grow baby tracker

Next.js 16 App Router, Prisma + PostgreSQL, NextAuth v5 JWT.

Features: dashboard quick-log, timeline, growth charts (WHO percentiles),
stats, journal/notes, doctor notes, milestones, vaccinations, settings,
superadmin panel. Mobile-first with sidebar nav + bottom nav + quick-add FAB.
Dark mode, PWA push notifications, multi-family invite system.

Docker: multi-stage Dockerfile + docker-compose with postgres service.
This commit is contained in:
2026-06-13 01:52:46 +02:00
commit cd16c354c0
94 changed files with 14354 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
export async function GET(req: Request) {
const session = await auth();
if (!session?.user?.id) return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
const { searchParams } = new URL(req.url);
const babyId = searchParams.get("babyId");
if (!babyId) return NextResponse.json({ error: "babyId requis" }, { status: 400 });
const logs = await prisma.growthLog.findMany({
where: { babyId },
orderBy: { date: "asc" },
});
return NextResponse.json(logs);
}
export async function POST(req: Request) {
const session = await auth();
if (!session?.user?.id) return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
const { babyId, date, weight, height, headCirc, notes } = await req.json();
if (!babyId || !date) {
return NextResponse.json({ error: "Champs requis manquants" }, { status: 400 });
}
const log = await prisma.growthLog.create({
data: {
babyId,
date: new Date(date),
weight: weight ?? null,
height: height ?? null,
headCirc: headCirc ?? null,
notes: notes ?? null,
},
});
return NextResponse.json(log, { status: 201 });
}