mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
tweaking property meta and condition report apis
This commit is contained in:
parent
52cb8790a6
commit
a3b7de9873
2 changed files with 35 additions and 1 deletions
|
|
@ -0,0 +1,34 @@
|
|||
import { db } from "@/app/db/db";
|
||||
import { property } from "@/app/db/schema/property";
|
||||
import { serializeBigInt } from "@/app/utils";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { propertyId: string } }
|
||||
) {
|
||||
const propertyId = params.propertyId;
|
||||
|
||||
const propertyMeta = await db.query.property.findFirst({
|
||||
columns: {
|
||||
id: true,
|
||||
address: true,
|
||||
postcode: true,
|
||||
hasPreConditionReport: true,
|
||||
hasRecommendations: true,
|
||||
createdAt: true,
|
||||
propertyType: true,
|
||||
builtForm: true,
|
||||
localAuthority: true,
|
||||
constituency: true,
|
||||
numberOfRooms: true,
|
||||
yearBuilt: true,
|
||||
tenure: true,
|
||||
currentEpcRating: true,
|
||||
currentSapPoints: true,
|
||||
},
|
||||
where: eq(property.id, BigInt(propertyId)),
|
||||
});
|
||||
|
||||
return new Response(JSON.stringify(propertyMeta, serializeBigInt));
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { db } from "@/app/db/db";
|
||||
import { PropertyMeta, property } from "@/app/db/schema/property";
|
||||
import { property } from "@/app/db/schema/property";
|
||||
import { serializeBigInt } from "@/app/utils";
|
||||
import { eq } from "drizzle-orm";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue