mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Add comprehensive thesis management system with database migration
This commit introduces a complete thesis management interface and migrates the system from YAML-based storage to SQLite: Core Changes: - Add Database.php helper class with PDO connection and entity management - Add list.php for viewing all theses with filtering and sorting - Add edit.php for modifying existing thesis records - Add import.php for migrating legacy YAML data to SQLite - Add justfile with development tasks (serve, init-test-db, etc.) Documentation: - Add MIGRATION.md with complete migration guide and architecture docs - Update README.md with database setup and Just recipe instructions - Update .gitignore to exclude test databases and error logs Modified Forms: - Enhanced formulaire.php with transaction-based SQLite processing - Updated index.php with database-driven form options - Improved thanks.php to read from database views The new architecture provides: - Normalized database schema (19 tables, 2 views) - Transaction safety and referential integrity - CRUD operations for thesis management - Filtering by year, orientation, AP program, publication status - Secure file handling with metadata tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
40
front-backend/test_db.php
Normal file
40
front-backend/test_db.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// Simple test script to verify database connection and queries
|
||||
require_once 'Database.php';
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
echo "✓ Database connection successful\n";
|
||||
|
||||
// Test counting theses
|
||||
$count = $db->countPublishedTheses();
|
||||
echo "✓ Found {$count} published theses\n";
|
||||
|
||||
// Test getting theses
|
||||
$theses = $db->getPublishedTheses(5, 0);
|
||||
echo "✓ Retrieved " . count($theses) . " theses\n";
|
||||
|
||||
if (count($theses) > 0) {
|
||||
$first = $theses[0];
|
||||
echo "\nFirst thesis:\n";
|
||||
echo " ID: " . $first['id'] . "\n";
|
||||
echo " Title: " . $first['title'] . "\n";
|
||||
echo " Author(s): " . ($first['authors'] ?? 'N/A') . "\n";
|
||||
echo " Year: " . $first['year'] . "\n";
|
||||
|
||||
// Test getting single thesis
|
||||
$thesis = $db->getThesisById($first['id']);
|
||||
if ($thesis) {
|
||||
echo "✓ Successfully retrieved thesis details\n";
|
||||
echo " Orientation: " . ($thesis['orientation'] ?? 'N/A') . "\n";
|
||||
echo " AP Program: " . ($thesis['ap_program'] ?? 'N/A') . "\n";
|
||||
echo " Files: " . (count($thesis['files'] ?? [])) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n✓ All tests passed!\n";
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "✗ Error: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user