Remove obsolete test scripts and add new API controllers for dashboard and game management

- Deleted test scripts: test_jellyfin_execution.php, test_stash.php, test_xbvr.php, test_xbvr_sync.php, vite.config.js
- Added DashboardController for fetching dashboard statistics and recent activity
- Added GameController for managing games, including fetching all games, game details, and games by category
- Introduced various check scripts to validate database structures and data integrity for adult videos, games, gender data, posters, and TV show actors
This commit is contained in:
Lars Behrends
2026-01-18 01:42:03 +01:00
parent b728b0c72d
commit eb1ec1153d
29 changed files with 2685 additions and 2454 deletions

View File

@@ -8,6 +8,35 @@ use App\Controllers\Controller;
class BaseApiController extends Controller
{
protected function getPdo(): \PDO
{
// Get PDO from the container - this assumes PDO is registered in the DI container
global $container;
if ($container && $container->has('pdo')) {
return $container->get('pdo');
}
// Fallback to creating a new PDO connection
$host = $_ENV['DB_HOST'] ?? 'localhost';
$dbname = $_ENV['DB_NAME'] ?? 'medialib';
$username = $_ENV['DB_USER'] ?? 'root';
$password = $_ENV['DB_PASS'] ?? '';
try {
return new \PDO(
"mysql:host=$host;dbname=$dbname;charset=utf8mb4",
$username,
$password,
[
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
\PDO::ATTR_EMULATE_PREPARES => false,
]
);
} catch (\PDOException $e) {
throw new \Exception('Database connection failed: ' . $e->getMessage());
}
}
protected function success(Response $response, $data = null, int $status = 200): Response
{
$responseData = ['success' => true];