feat(WHE-23): add hybrid purchase parser with persisted parse metadata

This commit is contained in:
2026-03-05 04:43:57 +04:00
parent 3b1b6468db
commit ebb6ce4ce6
14 changed files with 1881 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
ALTER TABLE "purchase_messages" ADD COLUMN "parsed_amount_minor" bigint;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "parsed_currency" text;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "parsed_item_description" text;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "parser_mode" text;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "parser_confidence" integer;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "needs_review" integer DEFAULT 1 NOT NULL;--> statement-breakpoint
ALTER TABLE "purchase_messages" ADD COLUMN "parser_error" text;

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,13 @@
"when": 1772670548136,
"tag": "0002_tough_sandman",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1772671128084,
"tag": "0003_mature_roulette",
"breakpoints": true
}
]
}

View File

@@ -198,6 +198,13 @@ export const purchaseMessages = pgTable(
telegramThreadId: text('telegram_thread_id').notNull(),
telegramUpdateId: text('telegram_update_id').notNull(),
messageSentAt: timestamp('message_sent_at', { withTimezone: true }),
parsedAmountMinor: bigint('parsed_amount_minor', { mode: 'bigint' }),
parsedCurrency: text('parsed_currency'),
parsedItemDescription: text('parsed_item_description'),
parserMode: text('parser_mode'),
parserConfidence: integer('parser_confidence'),
needsReview: integer('needs_review').default(1).notNull(),
parserError: text('parser_error'),
processingStatus: text('processing_status').default('pending').notNull(),
ingestedAt: timestamp('ingested_at', { withTimezone: true }).defaultNow().notNull()
},