feat: add plan title field with data migration
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user