Merge branch 'main' of https://github.com/Hestia-Homes/assessment-model into feature/rebaseline-db-changes

This commit is contained in:
Khalim Conn-Kowlessar 2026-03-31 14:18:22 +00:00
commit 21b772ff2c
7 changed files with 12400 additions and 0 deletions

View file

@ -0,0 +1,13 @@
CREATE TYPE "public"."file_source" AS ENUM('pas hub', 'sharepoint', 'hubspot');--> statement-breakpoint
CREATE TYPE "public"."file_type" AS ENUM('photo_pack', 'site_note', 'rd_sap_site_note', 'pas_2023_ventilation', 'pas_2023_condition', 'pas_significance', 'par_photo_pack', 'pas_2023_property', 'pas_2023_occupancy');--> statement-breakpoint
CREATE TABLE "uploaded_files" (
"id" bigserial PRIMARY KEY NOT NULL,
"s3_file_bucket" text NOT NULL,
"s3_file_key" text NOT NULL,
"s3_upload_timestamp" timestamp with time zone NOT NULL,
"landlord_property_id" text,
"uprn" bigint,
"hubspot_listing_id" bigint,
"file_type" "file_type",
"file_source" "file_source"
);

View file

@ -0,0 +1,22 @@
ALTER TABLE "hubspot_deal_data" ADD COLUMN "pashub_link" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "sharepoint_link" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "dampmould_growth" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "pre_sap" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "coordinator" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "mtp_completion_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "mtp_re_model_completion_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "ioe_v3_completion_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "proposed_measures" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "approved_package" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "designer" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "design_completion_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "actual_measures_installed" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "installer" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "installer_handover" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "lodgement_status" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "measures_lodgement_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "lodgement_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "expected_commencement_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "surveyor" text;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "confirmed_survey_date" timestamp (6) with time zone;--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "confirmed_survey_time" text;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1107,6 +1107,20 @@
"when": 1774268836524,
"tag": "0157_cynical_serpent_society",
"breakpoints": true
},
{
"idx": 158,
"version": "7",
"when": 1774538269794,
"tag": "0158_ancient_colleen_wing",
"breakpoints": true
},
{
"idx": 159,
"version": "7",
"when": 1774965050131,
"tag": "0159_sad_molly_hayes",
"breakpoints": true
}
]
}

View file

@ -22,6 +22,29 @@ export const hubspotDealData = pgTable("hubspot_deal_data", {
coordinationStatus: text("coordination_status"),
designStatus: text("design_status"),
pashubLink: text("pashub_link"),
sharepointLink: text("sharepoint_link"),
dampmouldGrowth: text("dampmould_growth"),
preSap: text("pre_sap"),
coordinator: text("coordinator"),
mtpCompletionDate: timestamp("mtp_completion_date", { precision: 6, withTimezone: true }),
mtpReModelCompletionDate: timestamp("mtp_re_model_completion_date", { precision: 6, withTimezone: true }),
ioeV3CompletionDate: timestamp("ioe_v3_completion_date", { precision: 6, withTimezone: true }),
proposedMeasures: text("proposed_measures"),
approvedPackage: text("approved_package"),
designer: text("designer"),
designCompletionDate: timestamp("design_completion_date", { precision: 6, withTimezone: true }),
actualMeasuresInstalled: text("actual_measures_installed"),
installer: text("installer"),
installerHandover: text("installer_handover"),
lodgementStatus: text("lodgement_status"),
measuresLodgementDate: timestamp("measures_lodgement_date", { precision: 6, withTimezone: true }),
lodgementDate: timestamp("lodgement_date", { precision: 6, withTimezone: true }),
expectedCommencementDate: timestamp("expected_commencement_date", { precision: 6, withTimezone: true }),
surveyor: text("surveyor"),
confirmedSurveyDate: timestamp("confirmed_survey_date", { precision: 6, withTimezone: true }),
confirmedSurveyTime: text("confirmed_survey_time"),
createdAt: timestamp("created_at", { precision: 6, withTimezone: true })
.defaultNow()
.notNull(),

View file

@ -0,0 +1,36 @@
import { bigint, bigserial, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core";
export const fileType = pgEnum("file_type", [
"photo_pack",
"site_note",
"rd_sap_site_note",
"pas_2023_ventilation",
"pas_2023_condition",
"pas_significance",
"par_photo_pack",
"pas_2023_property",
"pas_2023_occupancy"
]);
export const fileSource = pgEnum("file_source", [
"pas hub",
"sharepoint",
"hubspot"
]);
export const uploadedFiles = pgTable(
"uploaded_files",
{
id: bigserial("id", { mode: "bigint" }).primaryKey(),
s3FileBucket: text("s3_file_bucket").notNull(),
s3FileKey: text("s3_file_key").notNull(),
s3UploadTimestamp: timestamp("s3_upload_timestamp", {
withTimezone: true
}).notNull(),
landlordPropertyId: text("landlord_property_id"),
uprn: bigint("uprn", { mode: "bigint" }),
hubspotListingId: bigint("hubspot_listing_id", { mode: "bigint" }),
fileType: fileType("file_type"),
source: fileSource("file_source")
}
);