setting up models for non-intrusive survey notes and added isOverride boolean to recommendations table

This commit is contained in:
Khalim Conn-Kowlessar 2024-04-13 16:15:00 +01:00
parent fb4a96dbc8
commit 329e77f274
2 changed files with 20 additions and 0 deletions

View file

@ -204,6 +204,25 @@ export const propertyTargets = pgTable("property_targets", {
heatDemand: text("heat_demand"),
});
// This is the model for the results of non-invasive surveys, associated with a property.
// We store the data against a uprn. Each row will contain a metadata about the survey itself
export const NonInstrusiveSurvey = pgTable("non_intrusive_survey", {
id: bigserial("id", { mode: "bigint" }).primaryKey(),
uprn: bigint("uprn", { mode: "bigint" }),
surveyDate: timestamp("survey_date"),
surveyor: text("surveyor"),
});
// This model contains the actual notes that were taken down during the non-invasive survey
export const NonIntrusiveSurveyNotes = pgTable("non_intrusive_survey_notes", {
id: bigserial("id", { mode: "bigint" }).primaryKey(),
surveyId: bigint("survey_id", { mode: "bigint" })
.notNull()
.references(() => NonInstrusiveSurvey.id),
title: text("title"),
note: text("note"),
});
export type Property = InferModel<typeof property, "select">;
export type PropertyDetailsEpc = InferModel<
typeof propertyDetailsEpc,

View file

@ -37,6 +37,7 @@ export const recommendation = pgTable("recommendation", {
rentalYieldIncrease: real("rental_yield_increase"),
totalWorkHours: real("total_work_hours"),
labourDays: real("labour_days"),
isOverride: boolean("is_override").default(false),
});
export const unitQuantity: [string, ...string[]] = ["m2", "part"];