house tracker: contact status per listing (whose turn, last message, viewing) and labelled filters
Some checks failed
Deploy production / deploy (push) Has been cancelled
Some checks failed
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
@@ -83,11 +83,25 @@ export const houseListings = houseSchema.table(
|
||||
lbmYear: integer('lbm_year'),
|
||||
lbmDetail: jsonb('lbm_detail').$type<Liveability>(),
|
||||
lbmQuery: text('lbm_query'),
|
||||
lbmScoredAt: timestamptz('lbm_scored_at')
|
||||
lbmScoredAt: timestamptz('lbm_scored_at'),
|
||||
// Contact with the agent/landlord (see contactStatuses in house-tracker/types.ts):
|
||||
// whose turn it is, the last message (when, from whom, a one-line summary), where the
|
||||
// conversation lives (mail thread, chat) and the viewing time once one is planned.
|
||||
contactStatus: text('contact_status'),
|
||||
contactAt: timestamptz('contact_at'),
|
||||
contactBy: text('contact_by'),
|
||||
contactNote: text('contact_note'),
|
||||
contactRef: text('contact_ref'),
|
||||
viewingAt: timestamptz('viewing_at')
|
||||
},
|
||||
(table) => [
|
||||
check('listings_offer_check', sql`offer IN ('rent', 'buy')`),
|
||||
check('listings_price_eur_check', sql`price_eur IS NULL OR price_eur >= 0`),
|
||||
check(
|
||||
'listings_contact_status_check',
|
||||
sql`contact_status IS NULL OR contact_status IN ('waiting_on_me', 'not_contacted', 'waiting_on_them', 'viewing', 'closed')`
|
||||
),
|
||||
check('listings_contact_by_check', sql`contact_by IS NULL OR contact_by IN ('me', 'them')`),
|
||||
uniqueIndex('listings_source_idx').on(table.source, table.sourceId),
|
||||
index('listings_active_idx')
|
||||
.on(table.offer, table.firstSeenAt.desc().nullsFirst())
|
||||
@@ -96,6 +110,9 @@ export const houseListings = houseSchema.table(
|
||||
index('listings_details_idx')
|
||||
.on(table.firstSeenAt.desc().nullsFirst())
|
||||
.where(sql`detail_fetched_at IS NULL`),
|
||||
index('listings_contact_idx')
|
||||
.on(table.contactStatus)
|
||||
.where(sql`contact_status IS NOT NULL`),
|
||||
index('listings_address_idx')
|
||||
.on(table.addressKey)
|
||||
.where(sql`address_key IS NOT NULL`)
|
||||
|
||||
Reference in New Issue
Block a user