mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
added additional fields to recommendations table and created plan and planRecommendations tables
This commit is contained in:
parent
f3637ee2b9
commit
f7073943a5
1 changed files with 29 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { property } from "@/app/db/schema/property";
|
||||
import {
|
||||
bigserial,
|
||||
text,
|
||||
|
|
@ -27,6 +28,10 @@ export interface Recommendation {
|
|||
|
||||
export const recommendation = pgTable("recommendation", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
propertyId: bigint("property_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => property.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
type: text("type").notNull(),
|
||||
description: text("description").notNull(),
|
||||
estimatedCost: real("estimated_cost"),
|
||||
|
|
@ -35,7 +40,12 @@ export const recommendation = pgTable("recommendation", {
|
|||
newUValue: real("new_u_value"),
|
||||
sapPoints: real("sap_points"),
|
||||
heatDemand: real("heat_demand"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
co2EquivalentSavings: real("co2_equivalent_savings"),
|
||||
energySavings: real("energy_savings"),
|
||||
energyCostSavings: real("energy_cost_savings"),
|
||||
propertyValuationIncrease: real("property_valuation_increase"),
|
||||
rentalYieldIncrease: real("rental_yield_increase"),
|
||||
totalWorkHours: real("total_work_hours"),
|
||||
});
|
||||
|
||||
export const recommendationMaterials = pgTable("recommendation_materials", {
|
||||
|
|
@ -50,3 +60,21 @@ export const recommendationMaterials = pgTable("recommendation_materials", {
|
|||
.references(() => material.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export const plan = pgTable("plan", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
isDefault: boolean("is_default").notNull(),
|
||||
});
|
||||
|
||||
export const planRecommendations = pgTable("plan_recommendations", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
planId: bigint("plan_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => plan.id),
|
||||
recommendationId: bigint("recommendation_id", {
|
||||
mode: "bigint",
|
||||
})
|
||||
.notNull()
|
||||
.references(() => recommendation.id),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue