<?php
require_once __DIR__ . '/../config/config.php';
$db = Database::getInstance();
$rows = $db->fetchAll('SELECT id,user_id,message_id,message_type,content,media_url,local_file,local_thumb,created_at FROM conversations WHERE (local_file IS NOT NULL OR local_thumb IS NOT NULL) ORDER BY created_at DESC LIMIT 20');
echo json_encode($rows, JSON_PRETTY_PRINT) . "\n";