feat: add plan title field with data migration

This commit is contained in:
2026-01-12 22:32:45 +01:00
parent 9db5466fb2
commit 3de2661f46
8 changed files with 72 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ export default async function DashboardPage({
/>
</div>
<div>
<h1 className="text-2xl font-bold">{dict.home.title}</h1>
<h1 className="text-2xl font-bold">{plan.title}</h1>
<p className="text-muted-foreground text-sm">
{plan.startDate.toLocaleDateString(lang)} - {plan.endDate.toLocaleDateString(lang)}
</p>

View File

@@ -4,14 +4,15 @@ import prisma from '@/lib/prisma';
export async function POST(req: Request) {
try {
const body = await req.json();
const { startDate, endDate, password, instructions } = body;
const { title, startDate, endDate, password, instructions } = body;
if (!startDate || !endDate || !password) {
if (!title || !startDate || !endDate || !password) {
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
}
const plan = await prisma.plan.create({
data: {
title,
startDate: new Date(startDate),
endDate: new Date(endDate),
password,