From a7184d6dd3b6739a82bb187c5f722e15037bafdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Fri, 2 Aug 2024 09:10:15 +0100 Subject: [PATCH] fix: Rebase issues --- app/api/route.ts | 16 +++++----------- app/schemas/calculationSchema.ts | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/api/route.ts b/app/api/route.ts index 5f04bd16..6e7c713b 100644 --- a/app/api/route.ts +++ b/app/api/route.ts @@ -192,23 +192,17 @@ export async function POST(req: Request) { console.log({ gasBillYearly }); return NextResponse.json({ - postcode, - houseType: data.houseType, - houseAge: data.houseAge ? parseFloat(data.houseAge.toString()) : null, - houseBedrooms: data.houseBedrooms - ? parseFloat(data.houseBedrooms.toString()) - : null, - houseSize: data.houseSize - ? parseFloat(data.houseSize.toString()) - : null, + postcode: input.housePostcode, + houseType: input.houseType, + houseAge: input.houseAge, + houseBedrooms: input.houseBedrooms, + houseSize: input.houseSize, averagePrice: parseFloat(averagePrice.toFixed(2)), itl3, gdhi, hpi: averageHpi, buildPrice, - averageRent, socialRentAdjustments, - socialRentAveEarning, numberOfTransactions, granularityPostcode, pricesPaid, diff --git a/app/schemas/calculationSchema.ts b/app/schemas/calculationSchema.ts index 8e6b30ef..99d0319e 100644 --- a/app/schemas/calculationSchema.ts +++ b/app/schemas/calculationSchema.ts @@ -12,7 +12,7 @@ export const calculationSchema = z.object({ .min(1, "housePostcode is required") .refine(fixPostcode, "Invalid postcode") .transform(parsePostcode) - .refine((postcode) => postcode.valid), + .refine((postcode) => postcode.valid, { message: "Invalid postcode" }), houseSize: z.coerce.number().positive("houseSize must be a positive integer"), houseAge: z.coerce.number().positive("houseAge must be a positive integer"), houseBedrooms: z.coerce