diff --git a/src/app/api/portfolio/route.ts b/src/app/api/portfolio/route.ts index 71b2992d..cf8303ca 100644 --- a/src/app/api/portfolio/route.ts +++ b/src/app/api/portfolio/route.ts @@ -46,7 +46,10 @@ export async function POST(request: NextRequest) { .values({ userId: userId, portfolioId: newPortfolioId, role: role }) .returning(); - return new NextResponse(JSON.stringify(response), { status: 201 }); + if (response.length !== 1) { + throw new Error("Got back more than one row from insert - investigate"); + } + return new NextResponse(JSON.stringify(response[0]), { status: 201 }); } catch (error) { console.error(error); throw error; diff --git a/src/app/components/home/Card.tsx b/src/app/components/home/Card.tsx index 6259dcae..398191c0 100644 --- a/src/app/components/home/Card.tsx +++ b/src/app/components/home/Card.tsx @@ -2,6 +2,7 @@ import React from "react"; import StatusBadge from "@/app/components/StatusBadge"; import { useRouter } from "next/navigation"; import { PortfolioStatus } from "@/app/db/schema/portfolio"; +import { formatNumber } from "@/app/utils"; const styles = { wrapper: @@ -28,6 +29,8 @@ const Card = ({ id, title, image, budget, status }: CardProps) => { router.push(`/portfolio/${id}`); } + const budgetFormatted = budget ? "£" + formatNumber(budget) : ""; + return (