<?php
require_once __DIR__ . '/../config/config.php';
$phone = $argv[1] ?? '573168950803';
$db = Database::getInstance();
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', [$phone]);
if (!$user) { echo "User not found for phone $phone\n"; exit; }
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 10', [$user['id']]);
echo "User id: " . $user['id'] . "\n";
echo json_encode($rows, JSON_PRETTY_PRINT) . "\n";