Adding energyAssessmentDocuments model

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-04 10:12:44 +01:00
parent 3c9b8b0ce5
commit 42d56835be
8 changed files with 2846 additions and 4 deletions

View file

@ -92,7 +92,7 @@ export async function GET(
],
},
{
title: "Annual Energy consumption (kWh)/unit",
title: "Annual energy demand (kWh)/unit",
scenarios: [
{
scenarioName: scenarioName,

View file

@ -0,0 +1 @@
ALTER TABLE "property_details_epc" ADD COLUMN "current_energy_demand_heating_hotwater" real;

File diff suppressed because it is too large Load diff

View file

@ -631,6 +631,13 @@
"when": 1723565509020,
"tag": "0089_superb_johnny_blaze",
"breakpoints": true
},
{
"idx": 90,
"version": "5",
"when": 1723570008314,
"tag": "0090_youthful_silver_centurion",
"breakpoints": true
}
]
}

View file

@ -139,5 +139,30 @@ export const energyAssessment = pgTable("energy_assessments", {
windows_area: real("windows_area"),
});
// Against each energy assessment, there are documents that are collected on site
// Define the table
export const DocumentType: [string, ...string[]] = [
"EPR",
"Condition Report",
"Evidence Report",
"Summary Information",
"Floor Plan",
];
export const DocumentTypeEnum = pgEnum("document_type", DocumentType);
export const energyAssessmentDocuments = pgTable(
"energy_assessment_documents",
{
id: bigserial("id", { mode: "bigint" }).primaryKey(),
energyAssessmentId: bigint("energy_assessment_id", {
mode: "bigint",
}).notNull(),
documentType: DocumentTypeEnum("document_type").notNull(),
documentLocation: text("document_location").notNull(),
}
);
// Types for the new table
export type EnergyAssessment = InferModel<typeof energyAssessment, "select">;

View file

@ -171,6 +171,9 @@ export const propertyDetailsEpc = pgTable("property_details_epc", {
primaryEnergyConsumption: real("primary_energy_consumption"),
co2Emissions: real("co2_emissions"),
currentEnergyDemand: real("current_energy_demand"),
currentEnergyDemandHeatingHotwater: real(
"current_energy_demand_heating_hotwater"
),
estimated: boolean("estimated").default(false),
});

View file

@ -209,7 +209,7 @@ export async function getOverviewPortfolioData(
],
},
{
title: "Annual Energy consumption (kWh)/unit",
title: "Annual energy demand (kWh)/unit",
scenarios: [
{
scenarioName: "Today",

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
// "target": "es5",
"target": "ESNext",
"target": "es5",
// "target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,