Merge pull request #302 from Hestia-Homes/migration/multi-entry-ordering
Some checks failed
Test Suite / unit-tests (push) Has been cancelled

Add multi_entry_ordering column to bulk_address_uploads
This commit is contained in:
Jun-te Kim 2026-06-02 14:54:50 +01:00 committed by GitHub
commit a5947d11b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10164 additions and 0 deletions

View file

@ -0,0 +1 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "multi_entry_ordering" jsonb;

File diff suppressed because it is too large Load diff

View file

@ -1527,6 +1527,13 @@
"when": 1780404222902,
"tag": "0217_gray_hellion",
"breakpoints": true
},
{
"idx": 218,
"version": "7",
"when": 1780408378351,
"tag": "0218_natural_umar",
"breakpoints": true
}
]
}

View file

@ -25,6 +25,17 @@ export interface MultiEntrySummary {
sample: MultiEntrySample | null;
}
// User-confirmed building-part ordering (ADR-0004). Keyed by entry-count so it
// can hold more than one count later; this iteration populates only the
// largest. permutations[count][k] = the 0-based file position holding building
// part k, where 0 = Main building, 1..N-1 = Extension 1..N-1.
// e.g. { "2": [1, 0] } => for 2-part rows the main building is file position 1.
export interface MultiEntryOrdering {
permutations: Record<string, number[]>;
// Set once the user confirms; gates Finalise when the upload is multi-entry.
confirmed: boolean;
}
export const bulkAddressUploads = pgTable("bulk_address_uploads", {
id: uuid("id").defaultRandom().primaryKey(),
portfolioId: text("portfolio_id").notNull(),
@ -38,6 +49,8 @@ export const bulkAddressUploads = pgTable("bulk_address_uploads", {
// Multi-entry building-part detection, computed at start-address-matching
// and read by the awaiting_review review surface (ADR-0004).
multiEntrySummary: jsonb("multi_entry_summary").$type<MultiEntrySummary>(),
// User-confirmed building-part ordering for the multi-entry sample (ADR-0004).
multiEntryOrdering: jsonb("multi_entry_ordering").$type<MultiEntryOrdering>(),
taskId: uuid("task_id"),
combinedOutputS3Uri: text("combined_output_s3_uri"),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),