reportsModel->dbConnect(); if (!isset($queryParams['data'])) { return new Response(403, ['Content-Type' => 'application/json'], json_encode(['error' => 'O parâmetro "data" não foi enviado corretamente, ou não existe. Tente novamente']), JSON_UNESCAPED_UNICODE); } try { $sql = 'SELECT * FROM queue_stats_mv WHERE datetime LIKE :receivedDate'; $stmt = $connection->prepare($sql); $data = $queryParams['data'] . '%'; $stmt->bindParam(':receivedDate', $data, \PDO::PARAM_STR); $stmt->execute(); $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); return new Response( 200, ['Content-Type' => 'application/json'], json_encode(['success' => true, 'data' => $result], JSON_UNESCAPED_UNICODE) ); } catch (\PDOException $e) { return new Response( 500, ['Content-Type' => 'application/json'], json_encode(['error' => 'Erro ao executar a consulta: ' . $e->getMessage()], JSON_UNESCAPED_UNICODE) ); } } }