feat: enhance purchase intentions with chat integration and offer tracking

- Added MongoDB chat/message integration for seller responses
- Improved seller response validation and default messaging
- Integrated automatic chat creation/update when responding to intentions
- Added highest custom offer fields to listing queries and models
- Enhanced listing data with top offer information for buyers
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-08 11:51:21 -03:00
1 parent d27526e026
commit d8e7d5d7e6
19 files changed
+806 -58

No files matched your search

@@ -0,0 +1,17 @@
-- Migration 020: Custom offer fields for purchase intentions
-- Criado em: 2025-02-07
ALTER TABLE purchase_intentions
ADD COLUMN IF NOT EXISTS custom_offer_amount NUMERIC(12, 2),
ADD COLUMN IF NOT EXISTS custom_offer_currency VARCHAR(20),
ADD COLUMN IF NOT EXISTS custom_offer_created_at TIMESTAMP WITHOUT TIME ZONE;
-- Atualizar registros existentes para evitar valores inconsistentes
UPDATE purchase_intentions
SET custom_offer_amount = NULL,
custom_offer_currency = NULL,
custom_offer_created_at = NULL
WHERE custom_offer_amount IS NOT NULL
OR custom_offer_currency IS NOT NULL
OR custom_offer_created_at IS NOT NULL;
+2 -1
View File
@@ -1,4 +1,4 @@
/**
/**
* Script de execução de migrations
* Executa todas as migrations SQL em ordem
*/
@@ -39,6 +39,7 @@ const MIGRATIONS = [
"017_add_items_foreign_key.sql",
"018_migrate_listings_to_unified_items.sql",
"019_subscription_tiers.sql",
"020_purchase_intentions_custom_offer.sql",
];
async function runMigrations() {