fix(api): agregar db() helper, corregir requireAuth() en check_whatsapp

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-24 09:27:03 -05:00
co-authored by Claude Sonnet 4.6
parent 92e4d01181
commit 9e7637582d
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -48,6 +48,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
requireAuthentication(); requireAuthentication();
/**
* Shorthand para obtener la conexión PDO.
*/
function db(): \PDO {
return Database::getInstance()->getConnection();
}
/** /**
* ID del admin autenticado actualmente. * ID del admin autenticado actualmente.
*/ */
+1 -1
View File
@@ -4,7 +4,7 @@
* Verifica si un número de teléfono está registrado en WhatsApp (tabla users). * Verifica si un número de teléfono está registrado en WhatsApp (tabla users).
*/ */
require_once __DIR__ . '/_helpers.php'; require_once __DIR__ . '/_helpers.php';
requireAuth(); // requireAuthentication() ya fue llamado por _helpers.php
$phone = trim($_GET['phone'] ?? ''); $phone = trim($_GET['phone'] ?? '');
if (!$phone) { jsonError('phone requerido', 400); } if (!$phone) { jsonError('phone requerido', 400); }