mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
roof
This commit is contained in:
parent
35156111d0
commit
6c7c43fb89
4 changed files with 9999 additions and 1 deletions
13
src/app/db/migrations/0208_noisy_arclight.sql
Normal file
13
src/app/db/migrations/0208_noisy_arclight.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
CREATE TYPE "public"."roof_type" AS ENUM('Flat, insulated', 'Flat, insulated (assumed)', 'Flat, limited insulation', 'Flat, limited insulation (assumed)', 'Flat, no insulation', 'Flat, no insulation (assumed)', 'Pitched, insulated', 'Pitched, insulated (assumed)', 'Pitched, insulated at rafters', 'Pitched, limited insulation', 'Pitched, limited insulation (assumed)', 'Pitched, no insulation', 'Pitched, no insulation (assumed)', 'Pitched, Unknown loft insulation', 'Pitched, 0 mm loft insulation', 'Pitched, 12 mm loft insulation', 'Pitched, 25 mm loft insulation', 'Pitched, 50 mm loft insulation', 'Pitched, 75 mm loft insulation', 'Pitched, 100 mm loft insulation', 'Pitched, 125 mm loft insulation', 'Pitched, 150 mm loft insulation', 'Pitched, 175 mm loft insulation', 'Pitched, 200 mm loft insulation', 'Pitched, 225 mm loft insulation', 'Pitched, 250 mm loft insulation', 'Pitched, 270 mm loft insulation', 'Pitched, 300 mm loft insulation', 'Pitched, 350 mm loft insulation', 'Pitched, 400 mm loft insulation', 'Pitched, 400+ mm loft insulation', 'Roof room(s), insulated', 'Roof room(s), insulated (assumed)', 'Roof room(s), limited insulation', 'Roof room(s), limited insulation (assumed)', 'Roof room(s), no insulation', 'Roof room(s), no insulation (assumed)', 'Roof room(s), ceiling insulated', 'Roof room(s), thatched', 'Roof room(s), thatched with additional insulation', 'Thatched', 'Thatched, with additional insulation', '(another dwelling above)', '(same dwelling above)', '(other premises above)', '(another premises above)', 'Another Premises Above', 'Unknown');--> statement-breakpoint
|
||||
CREATE TABLE "landlord_roof_type_overrides" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"portfolio_id" bigint NOT NULL,
|
||||
"description" text NOT NULL,
|
||||
"value" "roof_type" NOT NULL,
|
||||
"source" "override_source" NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "landlord_roof_type_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "landlord_roof_type_overrides" ADD CONSTRAINT "landlord_roof_type_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;
|
||||
9901
src/app/db/migrations/meta/0208_snapshot.json
Normal file
9901
src/app/db/migrations/meta/0208_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1457,6 +1457,13 @@
|
|||
"when": 1779807828419,
|
||||
"tag": "0207_flat_white_queen",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 208,
|
||||
"version": "7",
|
||||
"when": 1779811629325,
|
||||
"tag": "0208_noisy_arclight",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ import {
|
|||
import { portfolio } from "./portfolio";
|
||||
|
||||
// Enum string values mirror /workspaces/home/github/Model/domain/landlord_description_overrides/*.py
|
||||
// exactly (PropertyType.value, WallType.value, BuiltFormType.value). Keep in sync — see
|
||||
// exactly (PropertyType.value, WallType.value, BuiltFormType.value, RoofType.value). Keep in sync — see
|
||||
// docs/adr/0002-landlord-override-vocabulary.md.
|
||||
export const PropertyTypeValues: [string, ...string[]] = [
|
||||
"House",
|
||||
|
|
@ -81,6 +81,57 @@ export const BuiltFormTypeValues: [string, ...string[]] = [
|
|||
"Unknown",
|
||||
];
|
||||
|
||||
export const RoofTypeValues: [string, ...string[]] = [
|
||||
"Flat, insulated",
|
||||
"Flat, insulated (assumed)",
|
||||
"Flat, limited insulation",
|
||||
"Flat, limited insulation (assumed)",
|
||||
"Flat, no insulation",
|
||||
"Flat, no insulation (assumed)",
|
||||
"Pitched, insulated",
|
||||
"Pitched, insulated (assumed)",
|
||||
"Pitched, insulated at rafters",
|
||||
"Pitched, limited insulation",
|
||||
"Pitched, limited insulation (assumed)",
|
||||
"Pitched, no insulation",
|
||||
"Pitched, no insulation (assumed)",
|
||||
"Pitched, Unknown loft insulation",
|
||||
"Pitched, 0 mm loft insulation",
|
||||
"Pitched, 12 mm loft insulation",
|
||||
"Pitched, 25 mm loft insulation",
|
||||
"Pitched, 50 mm loft insulation",
|
||||
"Pitched, 75 mm loft insulation",
|
||||
"Pitched, 100 mm loft insulation",
|
||||
"Pitched, 125 mm loft insulation",
|
||||
"Pitched, 150 mm loft insulation",
|
||||
"Pitched, 175 mm loft insulation",
|
||||
"Pitched, 200 mm loft insulation",
|
||||
"Pitched, 225 mm loft insulation",
|
||||
"Pitched, 250 mm loft insulation",
|
||||
"Pitched, 270 mm loft insulation",
|
||||
"Pitched, 300 mm loft insulation",
|
||||
"Pitched, 350 mm loft insulation",
|
||||
"Pitched, 400 mm loft insulation",
|
||||
"Pitched, 400+ mm loft insulation",
|
||||
"Roof room(s), insulated",
|
||||
"Roof room(s), insulated (assumed)",
|
||||
"Roof room(s), limited insulation",
|
||||
"Roof room(s), limited insulation (assumed)",
|
||||
"Roof room(s), no insulation",
|
||||
"Roof room(s), no insulation (assumed)",
|
||||
"Roof room(s), ceiling insulated",
|
||||
"Roof room(s), thatched",
|
||||
"Roof room(s), thatched with additional insulation",
|
||||
"Thatched",
|
||||
"Thatched, with additional insulation",
|
||||
"(another dwelling above)",
|
||||
"(same dwelling above)",
|
||||
"(other premises above)",
|
||||
"(another premises above)",
|
||||
"Another Premises Above",
|
||||
"Unknown",
|
||||
];
|
||||
|
||||
export const OverrideSourceValues: [string, ...string[]] = [
|
||||
"classifier",
|
||||
"user",
|
||||
|
|
@ -89,6 +140,7 @@ export const OverrideSourceValues: [string, ...string[]] = [
|
|||
export const propertyTypeEnum = pgEnum("property_type", PropertyTypeValues);
|
||||
export const wallTypeEnum = pgEnum("wall_type", WallTypeValues);
|
||||
export const builtFormTypeEnum = pgEnum("built_form_type", BuiltFormTypeValues);
|
||||
export const roofTypeEnum = pgEnum("roof_type", RoofTypeValues);
|
||||
export const overrideSourceEnum = pgEnum(
|
||||
"override_source",
|
||||
OverrideSourceValues,
|
||||
|
|
@ -168,3 +220,28 @@ export const landlordBuiltFormTypeOverrides = pgTable(
|
|||
).on(table.portfolioId, table.description),
|
||||
}),
|
||||
);
|
||||
|
||||
export const landlordRoofTypeOverrides = pgTable(
|
||||
"landlord_roof_type_overrides",
|
||||
{
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
portfolioId: bigint("portfolio_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => portfolio.id, { onDelete: "cascade" }),
|
||||
description: text("description").notNull(),
|
||||
value: roofTypeEnum("value").notNull(),
|
||||
source: overrideSourceEnum("source").notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow()
|
||||
.$onUpdate(() => new Date()),
|
||||
},
|
||||
(table) => ({
|
||||
portfolioDescriptionUnique: unique(
|
||||
"landlord_roof_type_overrides_portfolio_description_unique",
|
||||
).on(table.portfolioId, table.description),
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue