Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/app/api/goals/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,17 @@ export async function POST(req: Request) {
recurrence?: Recurrence;
};

if (!body.title || !body.target) {
if (!body.title || !body.target) {
return Response.json({ error: "title and target required" }, { status: 400 });
}

if (body.title.trim().length > 100) {
return Response.json(
{ error: "Goal title must be 100 characters or fewer" },
{ status: 400 }
);
}

const recurrence: Recurrence = body.recurrence ?? "none";
if (!["none", "weekly", "monthly"].includes(recurrence)) {
return Response.json({ error: "Invalid recurrence value" }, { status: 400 });
Expand Down
Loading
Loading