Primer commit del sistema separado falta mejorar mucho

This commit is contained in:
nickpons666
2025-12-30 01:18:46 -06:00
commit 1679c73e52
2384 changed files with 472342 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../../../shared/utils/helpers.php';
require_once __DIR__ . '/../../../shared/auth/jwt.php';
require_once __DIR__ . '/../../../shared/database/connection.php';
// Verificar autenticación
$userData = JWTAuth::authenticate();
if (!$userData) {
jsonResponse(['success' => false, 'error' => 'No autenticado'], 401);
}
// Verificar permiso
if (!hasPermission('manage_recipients', 'discord')) {
jsonResponse(['success' => false, 'error' => 'No tienes permiso para eliminar destinatarios de Discord.'], 403);
}
$input = json_decode(file_get_contents('php://input'), true);
$id = $input['id'] ?? null;
if (!$id) {
jsonResponse(['success' => false, 'error' => 'ID requerido'], 400);
}
try {
$db = getDB();
$stmt = $db->prepare("DELETE FROM destinatarios_discord WHERE id = ?");
$stmt->execute([$id]);
jsonResponse(['success' => true]);
} catch (PDOException $e) {
jsonResponse(['success' => false, 'error' => $e->getMessage()], 500);
}