mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-12 13:28:55 +00:00
Merge pull request #278 from Hestia-Homes/feautre/additional_walltypes
built type
This commit is contained in:
commit
a08188404c
4 changed files with 9822 additions and 1 deletions
13
src/app/db/migrations/0207_flat_white_queen.sql
Normal file
13
src/app/db/migrations/0207_flat_white_queen.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
CREATE TYPE "public"."built_form_type" AS ENUM('Detached', 'Semi-Detached', 'Mid-Terrace', 'End-Terrace', 'Enclosed Mid-Terrace', 'Enclosed End-Terrace', 'Not Recorded', 'Unknown');--> statement-breakpoint
|
||||||
|
CREATE TABLE "landlord_built_form_type_overrides" (
|
||||||
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"portfolio_id" bigint NOT NULL,
|
||||||
|
"description" text NOT NULL,
|
||||||
|
"value" "built_form_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_built_form_type_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
|
||||||
|
);
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "landlord_built_form_type_overrides" ADD CONSTRAINT "landlord_built_form_type_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
9764
src/app/db/migrations/meta/0207_snapshot.json
Normal file
9764
src/app/db/migrations/meta/0207_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1450,6 +1450,13 @@
|
||||||
"when": 1779805963297,
|
"when": 1779805963297,
|
||||||
"tag": "0206_tense_raza",
|
"tag": "0206_tense_raza",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 207,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1779807828419,
|
||||||
|
"tag": "0207_flat_white_queen",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
import { portfolio } from "./portfolio";
|
import { portfolio } from "./portfolio";
|
||||||
|
|
||||||
// Enum string values mirror /workspaces/home/github/Model/domain/landlord_description_overrides/*.py
|
// Enum string values mirror /workspaces/home/github/Model/domain/landlord_description_overrides/*.py
|
||||||
// exactly (PropertyType.value, WallType.value). Keep in sync — see
|
// exactly (PropertyType.value, WallType.value, BuiltFormType.value). Keep in sync — see
|
||||||
// docs/adr/0002-landlord-override-vocabulary.md.
|
// docs/adr/0002-landlord-override-vocabulary.md.
|
||||||
export const PropertyTypeValues: [string, ...string[]] = [
|
export const PropertyTypeValues: [string, ...string[]] = [
|
||||||
"House",
|
"House",
|
||||||
|
|
@ -70,6 +70,17 @@ export const WallTypeValues: [string, ...string[]] = [
|
||||||
"Unknown",
|
"Unknown",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const BuiltFormTypeValues: [string, ...string[]] = [
|
||||||
|
"Detached",
|
||||||
|
"Semi-Detached",
|
||||||
|
"Mid-Terrace",
|
||||||
|
"End-Terrace",
|
||||||
|
"Enclosed Mid-Terrace",
|
||||||
|
"Enclosed End-Terrace",
|
||||||
|
"Not Recorded",
|
||||||
|
"Unknown",
|
||||||
|
];
|
||||||
|
|
||||||
export const OverrideSourceValues: [string, ...string[]] = [
|
export const OverrideSourceValues: [string, ...string[]] = [
|
||||||
"classifier",
|
"classifier",
|
||||||
"user",
|
"user",
|
||||||
|
|
@ -77,6 +88,7 @@ export const OverrideSourceValues: [string, ...string[]] = [
|
||||||
|
|
||||||
export const propertyTypeEnum = pgEnum("property_type", PropertyTypeValues);
|
export const propertyTypeEnum = pgEnum("property_type", PropertyTypeValues);
|
||||||
export const wallTypeEnum = pgEnum("wall_type", WallTypeValues);
|
export const wallTypeEnum = pgEnum("wall_type", WallTypeValues);
|
||||||
|
export const builtFormTypeEnum = pgEnum("built_form_type", BuiltFormTypeValues);
|
||||||
export const overrideSourceEnum = pgEnum(
|
export const overrideSourceEnum = pgEnum(
|
||||||
"override_source",
|
"override_source",
|
||||||
OverrideSourceValues,
|
OverrideSourceValues,
|
||||||
|
|
@ -131,3 +143,28 @@ export const landlordWallTypeOverrides = pgTable(
|
||||||
).on(table.portfolioId, table.description),
|
).on(table.portfolioId, table.description),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const landlordBuiltFormTypeOverrides = pgTable(
|
||||||
|
"landlord_built_form_type_overrides",
|
||||||
|
{
|
||||||
|
id: uuid("id").defaultRandom().primaryKey(),
|
||||||
|
portfolioId: bigint("portfolio_id", { mode: "bigint" })
|
||||||
|
.notNull()
|
||||||
|
.references(() => portfolio.id, { onDelete: "cascade" }),
|
||||||
|
description: text("description").notNull(),
|
||||||
|
value: builtFormTypeEnum("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_built_form_type_overrides_portfolio_description_unique",
|
||||||
|
).on(table.portfolioId, table.description),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue