diff --git a/www/api.fahrschultermin.de/public/index.php b/www/api.fahrschultermin.de/public/index.php index c898f81..322340f 100644 --- a/www/api.fahrschultermin.de/public/index.php +++ b/www/api.fahrschultermin.de/public/index.php @@ -1,2 +1,142 @@ 0, + 'path' => '/', + 'domain' => $config['session_domain'] ?? '', + 'secure' => $isHttps, + 'httponly' => true, + 'samesite' => $sameSite, +]); + +session_start(); + +// ── Database ─────────────────────────────────────────────────────────────────── +\App\Support\Database::configure($config); + +// ── Router ───────────────────────────────────────────────────────────────────── +use App\Http\Controllers\AppointmentsController; +use App\Http\Controllers\AuthController; +use App\Http\Controllers\BootstrapController; +use App\Http\Controllers\InstructorsController; +use App\Http\Controllers\ReferenceDataController; +use App\Http\Controllers\StudentsController; +use App\Http\Controllers\TenantsController; +use App\Http\Controllers\UsersController; +use App\Support\Request; +use App\Support\Router; + +$request = new Request(); +$router = new Router($request); +$path = $request->path(); + +// ── API Routes ───────────────────────────────────────────────────────────────── +if (str_starts_with($path, '/api/v1')) { + $auth = new AuthController(); + $bootstrapController = new BootstrapController(); + $students = new StudentsController(); + $references = new ReferenceDataController(); + $appointments = new AppointmentsController(); + $users = new UsersController(); + $tenants = new TenantsController(); + $instructors = new InstructorsController(); + + $router->post('/api/v1/auth/login', [$auth, 'login']); + $router->post('/api/v1/auth/logout', [$auth, 'logout']); + $router->get('/api/v1/auth/me', [$auth, 'me']); + $router->get('/api/v1/bootstrap', $bootstrapController); + $router->get('/api/v1/students', [$students, 'index']); + $router->post('/api/v1/students', [$students, 'store']); + $router->patch('/api/v1/students/{id}/training', [$students, 'updateTraining']); + $router->patch('/api/v1/students/{id}', [$students, 'update']); + $router->delete('/api/v1/students/{id}', [$students, 'destroy']); + $router->get('/api/v1/lesson-types', [$references, 'lessonTypes']); + $router->post('/api/v1/lesson-types', [$references, 'storeLessonType']); + $router->post('/api/v1/lesson-types/reorder', [$references, 'reorderLessonTypes']); + $router->patch('/api/v1/lesson-types/{id}', [$references, 'updateLessonType']); + $router->delete('/api/v1/lesson-types/{id}', [$references, 'destroyLessonType']); + $router->post('/api/v1/lesson-types/visibility', [$references, 'updateLessonTypeMatrix']); + $router->get('/api/v1/license-class-templates', [$references, 'templates']); + $router->post('/api/v1/license-class-templates', [$references, 'storeTemplate']); + $router->patch('/api/v1/license-class-templates/{id}', [$references, 'updateTemplate']); + $router->get('/api/v1/instructors', [$instructors, 'index']); + $router->post('/api/v1/instructors', [$instructors, 'store']); + $router->patch('/api/v1/instructors/{id}', [$instructors, 'update']); + $router->get('/api/v1/users', [$users, 'index']); + $router->post('/api/v1/users', [$users, 'store']); + $router->patch('/api/v1/users/{id}', [$users, 'update']); + $router->get('/api/v1/tenants', [$tenants, 'index']); + $router->post('/api/v1/tenants', [$tenants, 'store']); + $router->patch('/api/v1/tenants/{id}', [$tenants, 'update']); + $router->patch('/api/v1/tenant/profile', [$tenants, 'updateOwn']); + $router->get('/api/v1/appointments', [$appointments, 'index']); + $router->post('/api/v1/appointments/validate', [$appointments, 'validate']); + $router->post('/api/v1/appointments', [$appointments, 'store']); + $router->patch('/api/v1/appointments/{id}', [$appointments, 'update']); + $router->delete('/api/v1/appointments/{id}', [$appointments, 'destroy']); + + $router->dispatch(); + exit; +} + +// ── 404 ──────────────────────────────────────────────────────────────────────── +http_response_code(404); +header('Content-Type: application/json'); +echo json_encode(['message' => 'Not Found']); \ No newline at end of file diff --git a/www/fahrschultermin.de/app/Repositories/AppointmentRepository.php b/www/fahrschultermin.de/app/Repositories/AppointmentRepository.php index e2f15aa..b7f86d2 100644 --- a/www/fahrschultermin.de/app/Repositories/AppointmentRepository.php +++ b/www/fahrschultermin.de/app/Repositories/AppointmentRepository.php @@ -84,7 +84,7 @@ final class AppointmentRepository extends BaseRepository 'updated_at' => $timestamp, ]); - $appointmentId = (int) $this->db->lastInsertId(); + $appointmentId = (int) $this->lastInsertId(); $this->replaceUnits($appointmentId, $data['units_breakdown'] ?? []); return $this->find($tenantId, $appointmentId); diff --git a/www/fahrschultermin.de/app/Repositories/BaseRepository.php b/www/fahrschultermin.de/app/Repositories/BaseRepository.php index 6d46ea8..6e356f9 100644 --- a/www/fahrschultermin.de/app/Repositories/BaseRepository.php +++ b/www/fahrschultermin.de/app/Repositories/BaseRepository.php @@ -16,6 +16,11 @@ abstract class BaseRepository $this->db = Database::connection(); } + protected function lastInsertId(): string + { + return Database::lastInsertId(); + } + protected function now(): string { return gmdate('c'); diff --git a/www/fahrschultermin.de/app/Repositories/InstructorRepository.php b/www/fahrschultermin.de/app/Repositories/InstructorRepository.php index 7b13a06..925da75 100644 --- a/www/fahrschultermin.de/app/Repositories/InstructorRepository.php +++ b/www/fahrschultermin.de/app/Repositories/InstructorRepository.php @@ -45,7 +45,7 @@ final class InstructorRepository extends BaseRepository 'updated_at' => $timestamp, ]); - return $this->find($tenantId, (int) $this->db->lastInsertId()); + return $this->find($tenantId, (int) $this->lastInsertId()); } public function update(int $tenantId, int $id, array $data): ?array diff --git a/www/fahrschultermin.de/app/Repositories/ReferenceDataRepository.php b/www/fahrschultermin.de/app/Repositories/ReferenceDataRepository.php index e1d72f0..715930a 100644 --- a/www/fahrschultermin.de/app/Repositories/ReferenceDataRepository.php +++ b/www/fahrschultermin.de/app/Repositories/ReferenceDataRepository.php @@ -66,7 +66,7 @@ final class ReferenceDataRepository extends BaseRepository 'created_at' => $timestamp, 'updated_at' => $timestamp, ]); - $lessonTypeId = (int) $this->db->lastInsertId(); + $lessonTypeId = (int) $this->lastInsertId(); $this->replaceLessonTypeVisibility($tenantId, $lessonTypeId, $data['visible_template_ids'] ?? null); return $this->findLessonType($tenantId, $lessonTypeId); @@ -225,7 +225,7 @@ final class ReferenceDataRepository extends BaseRepository 'created_at' => $timestamp, 'updated_at' => $timestamp, ]); - $templateId = (int) $this->db->lastInsertId(); + $templateId = (int) $this->lastInsertId(); $this->replaceTemplateRequirements($templateId, $data['requirements'] ?? []); $this->attachTemplateToExistingStudentLessonTypes($tenantId, $templateId); diff --git a/www/fahrschultermin.de/app/Repositories/StudentRepository.php b/www/fahrschultermin.de/app/Repositories/StudentRepository.php index 4ad7894..8042efa 100644 --- a/www/fahrschultermin.de/app/Repositories/StudentRepository.php +++ b/www/fahrschultermin.de/app/Repositories/StudentRepository.php @@ -60,7 +60,7 @@ final class StudentRepository extends BaseRepository 'updated_at' => $timestamp, ]); - $studentId = (int) $this->db->lastInsertId(); + $studentId = (int) $this->lastInsertId(); $this->snapshotRequirements($studentId, (int) $data['template_id']); return $this->find($tenantId, $studentId); diff --git a/www/fahrschultermin.de/app/Repositories/TenantRepository.php b/www/fahrschultermin.de/app/Repositories/TenantRepository.php index 3c71a02..bc47c4f 100644 --- a/www/fahrschultermin.de/app/Repositories/TenantRepository.php +++ b/www/fahrschultermin.de/app/Repositories/TenantRepository.php @@ -40,7 +40,7 @@ final class TenantRepository extends BaseRepository 'updated_at' => $timestamp, ]); - return $this->find((int) $this->db->lastInsertId()); + return $this->find((int) $this->lastInsertId()); } public function update(int $id, array $data): ?array diff --git a/www/fahrschultermin.de/app/Repositories/UserRepository.php b/www/fahrschultermin.de/app/Repositories/UserRepository.php index 9e0664d..bce3629 100644 --- a/www/fahrschultermin.de/app/Repositories/UserRepository.php +++ b/www/fahrschultermin.de/app/Repositories/UserRepository.php @@ -74,7 +74,7 @@ final class UserRepository extends BaseRepository 'updated_at' => $timestamp, ]); - return $this->findById((int) $this->db->lastInsertId()); + return $this->findById((int) $this->lastInsertId()); } public function update(int $id, array $data): ?array diff --git a/www/fahrschultermin.de/app/Support/Database.php b/www/fahrschultermin.de/app/Support/Database.php index c895c52..a60ee17 100644 --- a/www/fahrschultermin.de/app/Support/Database.php +++ b/www/fahrschultermin.de/app/Support/Database.php @@ -5,15 +5,17 @@ declare(strict_types=1); namespace App\Support; use PDO; +use PDOException; final class Database { - private static string $path; private static ?PDO $connection = null; + private static array $config = []; - public static function configure(string $path): void + public static function configure(array $config): void { - self::$path = $path; + self::$config = $config; + self::$connection = null; // reset on reconfigure } public static function connection(): PDO @@ -22,16 +24,43 @@ final class Database return self::$connection; } - $directory = dirname(self::$path); - if (!is_dir($directory)) { - mkdir($directory, 0775, true); + $driver = self::$config['db_driver'] ?? 'sqlite'; + + if ($driver === 'pgsql') { + $host = self::$config['db_host'] ?? '127.0.0.1'; + $port = self::$config['db_port'] ?? '5432'; + $dbname = self::$config['db_database'] ?? ''; + $user = self::$config['db_username'] ?? ''; + $password = self::$config['db_password'] ?? ''; + + $dsn = "pgsql:host={$host};port={$port};dbname={$dbname}"; + self::$connection = new PDO($dsn, $user, $password); + } else { + $path = self::$config['db_path'] ?? self::$config['db_path'] ?? ''; + $directory = dirname($path); + if (!is_dir($directory)) { + mkdir($directory, 0775, true); + } + self::$connection = new PDO('sqlite:' . $path); + self::$connection->exec('PRAGMA foreign_keys = ON'); } - self::$connection = new PDO('sqlite:' . self::$path); self::$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); self::$connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - self::$connection->exec('PRAGMA foreign_keys = ON'); return self::$connection; } + + public static function isPostgres(): bool + { + return (self::$config['db_driver'] ?? 'sqlite') === 'pgsql'; + } + + public static function lastInsertId(): string + { + if (self::isPostgres()) { + return self::$connection->query('SELECT lastval()')->fetchColumn(); + } + return self::$connection->lastInsertId(); + } } diff --git a/www/fahrschultermin.de/app/bootstrap.php b/www/fahrschultermin.de/app/bootstrap.php index 044e7f1..591c80e 100644 --- a/www/fahrschultermin.de/app/bootstrap.php +++ b/www/fahrschultermin.de/app/bootstrap.php @@ -36,7 +36,7 @@ if (!is_dir($sessionPath)) { session_save_path($sessionPath); session_start(); -Database::configure($config['db_path']); +Database::configure($config); return [ 'config' => $config, diff --git a/www/fahrschultermin.de/config/app.php b/www/fahrschultermin.de/config/app.php index d252d45..40dcdfe 100644 --- a/www/fahrschultermin.de/config/app.php +++ b/www/fahrschultermin.de/config/app.php @@ -4,10 +4,35 @@ declare(strict_types=1); return [ 'app_name' => 'DriveTime Planner', - 'env' => 'local', - 'debug' => true, + 'env' => 'production', + 'debug' => false, + + // Database: set db_driver to 'pgsql' or 'sqlite' + 'db_driver' => 'pgsql', + 'db_host' => '127.0.0.1', + 'db_port' => '5433', + 'db_database' => 'fahrschultermin', + 'db_username' => 'fahrschultermin_api', + 'db_password' => 'X9wL3pN7kRtHvMbZs4cGfYu2Dj6qAe8t', + + // Legacy SQLite path (used when db_driver = 'sqlite') 'db_path' => __DIR__ . '/../storage/database/app.sqlite', + + // Session 'session_path' => __DIR__ . '/../storage/sessions', 'session_name' => 'drive_time_session', + 'session_domain' => '.fahrschultermin.de', + + // API + 'api_base_url' => 'https://api.fahrschultermin.de', + 'frontend_url' => 'https://fahrschultermin.de', + + // CORS + 'cors_allowed_origins' => [ + 'https://fahrschultermin.de', + 'https://www.fahrschultermin.de', + ], + + // Frontend asset path (for fahrschultermin.de frontend) 'frontend_entry' => __DIR__ . '/../public/assets/index.js', ]; diff --git a/www/fahrschultermin.de/database/import_pgsql.sql b/www/fahrschultermin.de/database/import_pgsql.sql new file mode 100644 index 0000000..64e7a28 --- /dev/null +++ b/www/fahrschultermin.de/database/import_pgsql.sql @@ -0,0 +1,518 @@ +INSERT INTO tenants (id, name, timezone, is_active, created_at, updated_at, location_label, latitude, longitude, federal_state) VALUES (1, 'Fahrschule Nordring', 'Europe/Berlin', 1, '2026-04-22T18:35:38+00:00', '2026-04-22T18:35:38+00:00', NULL, NULL, NULL, NULL); +INSERT INTO tenants (id, name, timezone, is_active, created_at, updated_at, location_label, latitude, longitude, federal_state) VALUES (2, 'madgerm', 'Europe/Berlin', 1, '2026-04-22 18:40:04', '2026-04-22T22:13:13+00:00', 'Dorsten', 51.656, 6.9643, 'NW'); +INSERT INTO users (id, tenant_id, role, email, password_hash, first_name, last_name, is_active, created_at, updated_at) VALUES (2, 1, 'tenant_admin', 'admin@nordring.test', '$2y$12$IIbaLmgMr9IH0pXxtuGUNeS73tyK7v/pfR0sMw5Edz4eDflX4W9RG', 'Jana', 'Koester', 1, '2026-04-22T18:35:38+00:00', '2026-04-22T18:35:38+00:00'); +INSERT INTO users (id, tenant_id, role, email, password_hash, first_name, last_name, is_active, created_at, updated_at) VALUES (3, 1, 'dispatcher', 'planung@nordring.test', '$2y$12$EdKSdiQwqoMz6btxR2nZBuo59F6EqdqdQboI06IeHUAkfpqjuIa8q', 'Mara', 'Dispo', 1, '2026-04-22T18:35:38+00:00', '2026-04-22T18:35:38+00:00'); +INSERT INTO users (id, tenant_id, role, email, password_hash, first_name, last_name, is_active, created_at, updated_at) VALUES (4, 1, 'instructor', 'fahrlehrer@nordring.test', '$2y$12$JGNkoZrs/Ga2qgz0r2BZy.LJLv4WZm/EqkfauWe1Avsn7n8lymXGy', 'Tobias', 'Fahr', 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO users (id, tenant_id, role, email, password_hash, first_name, last_name, is_active, created_at, updated_at) VALUES (5, NULL, 'superadmin', 'armin.ploeger@live.de', '$2y$12$oZmKClGFa380ugvANeYX1OcVpjRWs9gNiJtWE6KhfzqTBMMgJlTFS', 'Armin', 'Ploeger', 1, '2026-04-22 18:40:04', '2026-04-22T18:40:49+00:00'); +INSERT INTO users (id, tenant_id, role, email, password_hash, first_name, last_name, is_active, created_at, updated_at) VALUES (6, 2, 'tenant_admin', 'madgerm@msn.com', '$2y$12$c6VKMJBHSdMHNZoxKB8UP.6i3zPVvAURudyOPMKmVn000TTADGZLC', 'madgerm', '', 1, '2026-04-22 18:40:04', '2026-04-22T19:20:46+00:00'); +INSERT INTO instructors (id, tenant_id, first_name, last_name, color, notes, is_active, created_at, updated_at, user_id, pre_start_buffer_minutes) VALUES (1, 1, 'Tobias', 'Fahr', '#0E5D80', '', 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', 4, 0); +INSERT INTO instructors (id, tenant_id, first_name, last_name, color, notes, is_active, created_at, updated_at, user_id, pre_start_buffer_minutes) VALUES (2, 1, 'Leonie', 'Kraft', '#A74826', '', 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL, 0); +INSERT INTO instructors (id, tenant_id, first_name, last_name, color, notes, is_active, created_at, updated_at, user_id, pre_start_buffer_minutes) VALUES (3, 2, 'Armin', '', '#0e5d80', '', 1, '2026-04-22T19:37:18+00:00', '2026-04-24T09:00:39+00:00', NULL, 60); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (1, 1, 'C', 'Klasse C', 0, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (2, 1, 'CE', 'Klasse CE', 0, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (3, 1, 'C+CE', 'Klasse C + CE', 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (4, 1, 'C1', 'Klasse C1', 0, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (5, 1, 'C1E', 'Klasse C1E', 0, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (6, 1, 'C1+C1E', 'Klasse C1 + C1E', 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (7, 2, 'Feuerwehren C', 'Feuerwehren C', 0, '2026-04-22T18:43:17+00:00', '2026-04-24T07:39:17+00:00'); +INSERT INTO license_class_templates (id, tenant_id, code, name, is_combination, created_at, updated_at) VALUES (8, 2, 'Feuerwehr C+CE', 'Feuerwehr C+CE', 1, '2026-04-22T19:19:55+00:00', '2026-04-24T06:50:58+00:00'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (1, 1, 'practice', 'Uebungsstunden', 8, 0, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (2, 1, 'rural', 'Ueberland', 5, 1, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (3, 1, 'highway', 'Autobahn', 4, 2, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (4, 1, 'night', 'Nachtfahrt', 3, 3, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (5, 2, 'practice', 'Uebungsstunden', 10, 0, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (6, 2, 'rural', 'Ueberland', 5, 1, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (7, 2, 'highway', 'Autobahn', 5, 2, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (8, 2, 'night', 'Nachtfahrt', 3, 3, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (13, 4, 'practice', 'Uebungsstunden', 6, 0, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (14, 4, 'rural', 'Ueberland', 4, 1, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (15, 4, 'highway', 'Autobahn', 3, 2, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (16, 4, 'night', 'Nachtfahrt', 2, 3, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (17, 5, 'practice', 'Uebungsstunden', 7, 0, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (18, 5, 'rural', 'Ueberland', 4, 1, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (19, 5, 'highway', 'Autobahn', 3, 2, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (20, 5, 'night', 'Nachtfahrt', 2, 3, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (56, 8, 'C::lesson_type_14', 'Einweisung', 1, 0, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (57, 8, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (58, 8, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (59, 8, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (60, 8, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (61, 8, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (62, 8, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (63, 8, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (64, 8, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (65, 8, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (66, 8, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (67, 8, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (100, 7, 'lesson_type_14', 'Einweisung', 1, 0, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (101, 7, 'lesson_type_15', 'Übungsstunde', 8, 1, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (102, 7, 'lesson_type_12', 'Überlandfahrt', 5, 2, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (103, 7, 'lesson_type_13', 'Autobahnfahrt', 2, 3, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (104, 7, 'lesson_type_11', 'Nachtfahrten', 3, 4, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (105, 7, 'lesson_type_16', 'Praktische Prüfung', 1, 5, ''); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (138, 3, 'C::practice', 'Uebungsstunden', 8, 0, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (139, 3, 'C::rural', 'Ueberland', 5, 1, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (140, 3, 'C::highway', 'Autobahn', 4, 2, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (141, 3, 'C::night', 'Nachtfahrt', 3, 3, 'C'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (142, 3, 'CE::practice', 'Uebungsstunden', 6, 100, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (143, 3, 'CE::rural', 'Ueberland', 3, 101, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (144, 3, 'CE::highway', 'Autobahn', 3, 102, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (145, 3, 'CE::night', 'Nachtfahrt', 2, 103, 'CE'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (146, 6, 'C1::practice', 'Uebungsstunden', 6, 0, 'C1'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (147, 6, 'C1::rural', 'Ueberland', 4, 1, 'C1'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (148, 6, 'C1::highway', 'Autobahn', 3, 2, 'C1'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (149, 6, 'C1::night', 'Nachtfahrt', 2, 3, 'C1'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (150, 6, 'C1E::practice', 'Uebungsstunden', 4, 100, 'C1E'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (151, 6, 'C1E::rural', 'Ueberland', 2, 101, 'C1E'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (152, 6, 'C1E::highway', 'Autobahn', 2, 102, 'C1E'); +INSERT INTO license_template_requirements (id, template_id, requirement_key, label, required_units, sort_order, phase_label) VALUES (153, 6, 'C1E::night', 'Nachtfahrt', 1, 103, 'C1E'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (1, 1, 'Einweisung', '#0E5D80', 45, 'student', 'intro', 1, 1, 1, 0, 1, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2, 1, 'Uebungsstunde', '#2C7A4B', 45, 'student', 'practice', 1, 1, 1, 0, 2, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (3, 1, 'Bundes- / Landstrasse', '#D99A1A', 45, 'student', 'rural', 1, 1, 1, 0, 3, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (4, 1, 'Autobahn', '#C86C1E', 45, 'student', 'highway', 1, 1, 1, 0, 4, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (5, 1, 'Daemmerung / Dunkelheit', '#4B356B', 45, 'student', 'night', 1, 1, 1, 0, 5, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (6, 1, 'Pruefungsfahrt', '#A83333', 70, 'student', NULL, 1, 0, 1, 1, 6, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (7, 1, 'Theorieunterricht', '#2B8793', 90, 'work', NULL, 0, 0, 0, 1, 7, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (8, 1, 'Sonstige Arbeiten', '#70747C', 60, 'work', NULL, 0, 0, 0, 1, 8, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (9, 1, 'Privater Termin', '#44444A', 60, 'private', NULL, 0, 0, 0, 1, 9, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (10, 1, 'Sperrzeit / Blockierung', '#111111', 60, 'blocked', NULL, 0, 0, 0, 1, 10, '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (11, 2, 'Nachtfahrten', '#000000', 45, 'student', NULL, 1, 1, 1, 0, 5, '2026-04-22T18:49:50+00:00', '2026-04-22T19:23:23+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (12, 2, 'Überlandfahrt', '#02882a', 45, 'student', NULL, 1, 1, 1, 0, 3, '2026-04-22T19:01:19+00:00', '2026-04-22T19:23:23+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (13, 2, 'Autobahnfahrt', '#c4660e', 45, 'student', NULL, 1, 1, 1, 0, 4, '2026-04-22T19:05:14+00:00', '2026-04-22T19:23:23+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (14, 2, 'Einweisung', '#e65c4c', 45, 'student', NULL, 1, 1, 1, 0, 1, '2026-04-22T19:06:35+00:00', '2026-04-22T19:23:23+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (15, 2, 'Übungsstunde', '#e65c4c', 45, 'student', NULL, 1, 1, 1, 0, 2, '2026-04-22T19:06:36+00:00', '2026-04-22T19:23:23+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (16, 2, 'Praktische Prüfung', '#11ff00', 85, 'student', NULL, 1, 1, 1, 0, 6, '2026-04-23T05:14:13+00:00', '2026-05-05T19:03:08+00:00', NULL); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (17, 2, 'Privat', '#6B7280', 60, 'private', NULL, 0, 0, 0, 0, 900, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'private_block'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (18, 2, 'Fahrzeugpflege', '#0E5D80', 60, 'work', NULL, 0, 0, 1, 0, 910, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'work_vehicle_care'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (19, 2, 'Buero', '#8B5A2B', 60, 'work', NULL, 0, 0, 1, 0, 920, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'work_office'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (20, 2, 'Wechselfahrt', '#3B7A57', 45, 'work', NULL, 0, 0, 1, 0, 930, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'work_transfer_drive'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (21, 2, 'Sonstige Taetigkeit', '#7C3AED', 60, 'work', NULL, 0, 0, 1, 0, 940, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'work_other'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (22, 2, 'Theorie A', '#C2410C', 90, 'theory', NULL, 0, 0, 1, 0, 950, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_a'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (23, 2, 'Theorie B', '#A74826', 90, 'theory', NULL, 0, 0, 1, 0, 960, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_b'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (24, 2, 'Theorie C', '#B45309', 90, 'theory', NULL, 0, 0, 1, 0, 970, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_c'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (25, 2, 'Theorie D', '#BE123C', 90, 'theory', NULL, 0, 0, 1, 0, 980, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_d'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (26, 2, 'Theorie T', '#047857', 90, 'theory', NULL, 0, 0, 1, 0, 990, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_t'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (27, 2, 'Theorie BKF', '#1D4ED8', 90, 'theory', NULL, 0, 0, 1, 0, 1000, '2026-04-23T07:26:51+00:00', '2026-04-23T07:26:51+00:00', 'theory_bkf'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2327, 1, 'Privat', '#6B7280', 60, 'private', NULL, 0, 0, 0, 0, 900, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'private_block'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2328, 1, 'Fahrzeugpflege', '#0E5D80', 60, 'work', NULL, 0, 0, 1, 0, 910, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'work_vehicle_care'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2329, 1, 'Buero', '#8B5A2B', 60, 'work', NULL, 0, 0, 1, 0, 920, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'work_office'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2330, 1, 'Wechselfahrt', '#3B7A57', 45, 'work', NULL, 0, 0, 1, 0, 930, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'work_transfer_drive'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2331, 1, 'Sonstige Taetigkeit', '#7C3AED', 60, 'work', NULL, 0, 0, 1, 0, 940, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'work_other'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2332, 1, 'Theorie A', '#C2410C', 90, 'theory', NULL, 0, 0, 1, 0, 950, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_a'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2333, 1, 'Theorie B', '#A74826', 90, 'theory', NULL, 0, 0, 1, 0, 960, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_b'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2334, 1, 'Theorie C', '#B45309', 90, 'theory', NULL, 0, 0, 1, 0, 970, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_c'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2335, 1, 'Theorie D', '#BE123C', 90, 'theory', NULL, 0, 0, 1, 0, 980, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_d'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2336, 1, 'Theorie T', '#047857', 90, 'theory', NULL, 0, 0, 1, 0, 990, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_t'); +INSERT INTO lesson_types (id, tenant_id, name, color, default_duration, category, requirement_key, is_billable, is_counted, is_rest_relevant, fixed_duration, sort_order, created_at, updated_at, system_key) VALUES (2337, 1, 'Theorie BKF', '#1D4ED8', 90, 'theory', NULL, 0, 0, 1, 0, 1000, '2026-04-24T06:39:44+00:00', '2026-04-24T06:39:44+00:00', 'theory_bkf'); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (1, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (2, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (3, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (4, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (5, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 1); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 3); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 4); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 6); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 5); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (6, 2); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (11, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (12, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (13, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (14, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (15, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (11, 8); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (12, 8); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (13, 8); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (14, 8); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (15, 8); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (16, 7); +INSERT INTO lesson_type_template_visibility (lesson_type_id, template_id) VALUES (16, 8); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (1, 1, 3, 'Mila', 'Hansen', '0170 1234567', 'Startet naechste Woche mit Nachtfahrten.', 'active', '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (2, 1, 4, 'Jonas', 'Winter', '0172 999000', 'Braucht fruehe Termine.', 'active', '2026-04-22T18:35:39+00:00', '2026-04-22T18:35:39+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (3, 2, 7, '-', 'Nöllecke', '', '', 'active', '2026-04-22T18:48:52+00:00', '2026-04-23T07:37:52+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (4, 2, 7, '-', 'Nappenfeld', '', '', 'active', '2026-04-22T19:31:04+00:00', '2026-04-23T07:37:12+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (6, 2, 7, '-', 'Storck', '', '', 'active', '2026-04-22T19:31:45+00:00', '2026-04-23T07:38:05+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (7, 2, 7, '-', 'Ronneburger', '', '', 'active', '2026-04-22T19:31:58+00:00', '2026-04-23T07:38:02+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (9, 2, 8, '-', 'Mrowitzki', '', '', 'active', '2026-04-23T05:20:18+00:00', '2026-04-23T07:37:46+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (10, 2, 8, '-', 'Klaas', '', '', 'active', '2026-04-23T05:20:58+00:00', '2026-04-23T08:37:10+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (11, 2, 8, '-', 'Wioliczkp', '', '', 'active', '2026-04-23T05:21:33+00:00', '2026-04-23T08:36:13+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (13, 2, 8, '-', 'Pölling', '', '', 'active', '2026-04-23T05:22:18+00:00', '2026-04-24T07:22:23+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (14, 2, 8, '-', 'Hardameck', '', '', 'active', '2026-04-23T05:22:26+00:00', '2026-04-23T07:37:28+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (15, 2, 7, '-', 'Lawniczek', '', '', 'active', '2026-04-23T05:22:52+00:00', '2026-04-23T08:37:22+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (17, 2, 8, '-', 'Lackmann', '', '', 'active', '2026-04-23T07:34:23+00:00', '2026-04-23T07:34:23+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (19, 2, 8, 'egal', 'bowens', '', '', 'active', '2026-05-07T12:00:21+00:00', '2026-05-07T12:00:21+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (20, 2, 8, 'egal', 'gröning', '', '', 'active', '2026-05-07T12:00:38+00:00', '2026-05-07T12:00:38+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (21, 2, 7, 'egal', 'kobitzsch', '', '', 'active', '2026-05-07T12:00:52+00:00', '2026-05-07T12:01:20+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (22, 2, 8, 'egal', 'gregor schlosser', '', '', 'active', '2026-05-07T12:01:02+00:00', '2026-05-07T12:01:02+00:00', '', 0); +INSERT INTO students (id, tenant_id, template_id, first_name, last_name, phone, notes, status, created_at, updated_at, email, needs_glasses) VALUES (23, 2, 8, '-', 'Kuckel', '', '', 'active', '2026-05-11T17:44:52+00:00', '2026-05-11T17:44:52+00:00', '', 0); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (13, 4, 'lesson_type_14', 'Einweisung', 1, 0, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (14, 4, 'lesson_type_15', 'Übungsstunde', 8, 1, 6, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (15, 4, 'lesson_type_12', 'Überlandfahrt', 5, 2, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (16, 4, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (17, 4, 'lesson_type_11', 'Nachtfahrten', 3, 4, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (23, 6, 'lesson_type_14', 'Einweisung', 1, 0, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (24, 6, 'lesson_type_15', 'Übungsstunde', 8, 1, 4, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (25, 6, 'lesson_type_12', 'Überlandfahrt', 5, 2, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (26, 6, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 2, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (27, 6, 'lesson_type_11', 'Nachtfahrten', 3, 4, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (28, 7, 'lesson_type_14', 'Einweisung', 1, 0, 1, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (29, 7, 'lesson_type_15', 'Übungsstunde', 8, 1, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (30, 7, 'lesson_type_12', 'Überlandfahrt', 5, 2, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (31, 7, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (32, 7, 'lesson_type_11', 'Nachtfahrten', 3, 4, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (68, 15, 'lesson_type_14', 'Einweisung', 1, 0, 1, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (69, 15, 'lesson_type_11', 'Nachtfahrten', 3, 4, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (70, 15, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 2, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (71, 15, 'lesson_type_12', 'Überlandfahrt', 5, 2, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (72, 15, 'lesson_type_15', 'Übungsstunde', 8, 1, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (86, 15, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (88, 4, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (89, 3, 'lesson_type_14', 'Einweisung', 1, 0, 1, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (90, 3, 'lesson_type_15', 'Übungsstunde', 8, 1, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (91, 3, 'lesson_type_12', 'Überlandfahrt', 5, 2, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (92, 3, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (93, 3, 'lesson_type_11', 'Nachtfahrten', 3, 4, 3, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (94, 3, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (96, 7, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (97, 6, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (101, 14, 'C::lesson_type_14', 'Einweisung', 1, 0, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (102, 14, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (103, 14, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 2, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (104, 14, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (105, 14, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (106, 14, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (107, 14, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (108, 14, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (109, 14, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (110, 14, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (111, 14, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (112, 14, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (113, 10, 'C::lesson_type_14', 'Einweisung', 1, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (114, 10, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (115, 10, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 3, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (116, 10, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (117, 10, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (118, 10, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (119, 10, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (120, 10, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (121, 10, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (122, 10, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (123, 10, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (124, 10, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (125, 17, 'C::lesson_type_14', 'Einweisung', 1, 0, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (126, 17, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (127, 17, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 6, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (128, 17, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (129, 17, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (130, 17, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (131, 17, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (132, 17, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (133, 17, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (134, 17, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (135, 17, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (136, 17, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (137, 9, 'C::lesson_type_14', 'Einweisung', 1, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (138, 9, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (139, 9, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 5, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (140, 9, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (141, 9, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (142, 9, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (143, 9, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (144, 9, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (145, 9, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (146, 9, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (147, 9, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (148, 9, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (149, 13, 'C::lesson_type_14', 'Einweisung', 1, 0, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (150, 13, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (151, 13, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 4, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (152, 13, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (153, 13, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 2, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (154, 13, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (155, 13, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (156, 13, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (157, 13, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (158, 13, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (159, 13, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (160, 13, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (161, 11, 'C::lesson_type_14', 'Einweisung', 1, 0, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (162, 11, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (163, 11, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 6, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (164, 11, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (165, 11, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (166, 11, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (167, 11, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (168, 11, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (169, 11, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (170, 11, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (171, 11, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (172, 11, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (205, 1, 'C::highway', 'Autobahn', 4, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (206, 1, 'C::night', 'Nachtfahrt', 3, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (207, 1, 'C::practice', 'Uebungsstunden', 8, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (208, 1, 'C::rural', 'Ueberland', 5, 1, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (209, 1, 'CE::highway', 'Autobahn', 3, 102, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (210, 1, 'CE::night', 'Nachtfahrt', 2, 103, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (211, 1, 'CE::practice', 'Uebungsstunden', 6, 100, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (212, 1, 'CE::rural', 'Ueberland', 3, 101, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (225, 19, 'C::lesson_type_14', 'Einweisung', 1, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (226, 19, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (227, 19, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (228, 19, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (229, 19, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (230, 19, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (231, 19, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (232, 19, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (233, 19, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (234, 19, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (235, 19, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (236, 19, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (237, 20, 'C::lesson_type_14', 'Einweisung', 1, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (238, 20, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (239, 20, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (240, 20, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (241, 20, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (242, 20, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (243, 20, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (244, 20, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (245, 20, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (246, 20, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (247, 20, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (248, 20, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (261, 22, 'C::lesson_type_14', 'Einweisung', 1, 0, 1, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (262, 22, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (263, 22, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 7, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (264, 22, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (265, 22, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 2, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (266, 22, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (267, 22, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 2, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (268, 22, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (269, 22, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (270, 22, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (271, 22, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (272, 22, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (273, 21, 'lesson_type_14', 'Einweisung', 1, 0, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (274, 21, 'lesson_type_15', 'Übungsstunde', 8, 1, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (275, 21, 'lesson_type_12', 'Überlandfahrt', 5, 2, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (276, 21, 'lesson_type_13', 'Autobahnfahrt', 2, 3, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (277, 21, 'lesson_type_11', 'Nachtfahrten', 3, 4, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (278, 21, 'lesson_type_16', 'Praktische Prüfung', 1, 5, 0, ''); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (279, 23, 'C::lesson_type_14', 'Einweisung', 1, 0, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (280, 23, 'CE::lesson_type_14', 'Einweisung', 0, 1000, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (281, 23, 'C::lesson_type_15', 'Übungsstunde', 7, 1, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (282, 23, 'CE::lesson_type_15', 'Übungsstunde', 8, 1001, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (283, 23, 'C::lesson_type_12', 'Überlandfahrt', 5, 2, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (284, 23, 'CE::lesson_type_12', 'Überlandfahrt', 3, 1002, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (285, 23, 'C::lesson_type_13', 'Autobahnfahrt', 2, 3, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (286, 23, 'CE::lesson_type_13', 'Autobahnfahrt', 1, 1003, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (287, 23, 'C::lesson_type_11', 'Nachtfahrten', 3, 4, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (288, 23, 'CE::lesson_type_11', 'Nachtfahrten', 0, 1004, 0, 'CE'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (289, 23, 'C::lesson_type_16', 'Praktische Prüfung', 1, 5, 0, 'C'); +INSERT INTO student_requirement_snapshots (id, student_id, requirement_key, label, required_units, sort_order, prior_completed_units, phase_label) VALUES (290, 23, 'CE::lesson_type_16', 'Praktische Prüfung', 1, 1005, 0, 'CE'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (11, 2, 7, 3, 15, 'Übungsstunde', 'student', '2026-04-23T12:00:00+00:00', '2026-04-23T13:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T07:15:35+00:00', '2026-04-23T07:38:40+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (14, 2, 9, 3, 15, 'Übungsstunde', 'student', '2026-04-23T13:45:00+00:00', '2026-04-23T16:00:00+00:00', 3, 'planned', '', 1, 6, 6, '2026-04-23T07:19:46+00:00', '2026-04-23T07:19:46+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (15, 2, 10, 3, 14, 'Einweisung', 'student', '2026-04-23T16:15:00+00:00', '2026-04-23T17:00:00+00:00', 1, 'planned', 'Erste Fahrstunde', 1, 6, 6, '2026-04-23T07:20:34+00:00', '2026-04-23T08:34:15+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (16, 2, 11, 3, 11, 'Nachtfahrten', 'student', '2026-04-23T19:15:00+00:00', '2026-04-23T21:30:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:21:23+00:00', '2026-04-24T09:12:56+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (17, 2, 6, 3, 15, 'Übungsstunde', 'student', '2026-04-24T13:45:00+00:00', '2026-04-24T16:00:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:22:07+00:00', '2026-04-24T08:19:09+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (18, 2, 10, 3, 15, 'Übungsstunde', 'student', '2026-04-24T16:15:00+00:00', '2026-04-24T18:30:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:22:58+00:00', '2026-04-24T07:43:59+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (19, 2, 13, 3, 11, 'Nachtfahrten', 'student', '2026-04-24T18:45:00+00:00', '2026-04-24T21:00:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:23:26+00:00', '2026-04-24T06:56:17+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (20, 2, 14, 3, 11, 'Nachtfahrten', 'student', '2026-04-24T21:00:00+00:00', '2026-04-24T23:15:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:24:01+00:00', '2026-04-24T07:30:07+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (22, 2, 3, 3, 15, 'Übungsstunde', 'student', '2026-04-27T07:45:00+00:00', '2026-04-27T10:45:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-04-23T07:26:26+00:00', '2026-04-24T07:36:25+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (23, 2, 13, 3, 12, 'Überlandfahrt', 'student', '2026-04-28T06:00:00+00:00', '2026-04-28T08:15:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:26:51+00:00', '2026-04-24T07:24:01+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (24, 2, 3, 3, 15, 'Übungsstunde', 'student', '2026-04-28T14:15:00+00:00', '2026-04-28T15:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-23T07:29:01+00:00', '2026-04-24T07:42:24+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (25, 2, 9, 3, 12, 'Überlandfahrt', 'student', '2026-04-29T09:00:00+00:00', '2026-04-29T10:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T07:29:48+00:00', '2026-04-24T07:47:37+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (26, 2, 11, 3, 13, 'Autobahnfahrt', 'student', '2026-04-29T06:30:00+00:00', '2026-04-29T08:00:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T07:31:31+00:00', '2026-04-24T08:10:04+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (27, 2, 3, 3, 12, 'Überlandfahrt', 'student', '2026-04-29T12:15:00+00:00', '2026-04-29T13:45:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T07:32:13+00:00', '2026-04-24T07:41:27+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (28, 2, 17, 3, 12, 'Überlandfahrt', 'student', '2026-04-28T08:30:00+00:00', '2026-04-28T10:45:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T07:36:17+00:00', '2026-04-24T08:02:02+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (29, 2, NULL, 3, 21, 'Sonstige Taetigkeit', 'work', '2026-04-23T10:00:00+00:00', '2026-04-23T11:45:00+00:00', 2, 'completed', '', 0, 6, 6, '2026-04-23T07:38:58+00:00', '2026-04-24T09:12:18+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (39, 2, 13, 3, 13, 'Autobahnfahrt', 'student', '2026-04-30T08:15:00+00:00', '2026-04-30T09:45:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T08:05:22+00:00', '2026-04-24T07:24:28+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (40, 2, 14, 3, 15, 'Übungsstunde', 'student', '2026-04-30T10:30:00+00:00', '2026-04-30T13:30:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-04-23T08:05:59+00:00', '2026-04-24T07:33:13+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (41, 2, 17, 3, 13, 'Autobahnfahrt', 'student', '2026-04-30T13:30:00+00:00', '2026-04-30T15:00:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T08:06:20+00:00', '2026-04-24T08:01:06+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (43, 2, 6, 3, 12, 'Überlandfahrt', 'student', '2026-05-04T11:15:00+00:00', '2026-05-04T14:15:00+00:00', 4, 'planned', '', 1, 6, 6, '2026-04-23T08:08:46+00:00', '2026-04-27T13:38:49+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (44, 2, 3, 3, 13, 'Autobahnfahrt', 'student', '2026-05-04T14:30:00+00:00', '2026-05-04T16:00:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-23T08:08:57+00:00', '2026-04-23T08:16:03+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (46, 2, 17, 3, 11, 'Nachtfahrten', 'student', '2026-05-02T18:15:00+00:00', '2026-05-02T20:30:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-23T08:09:52+00:00', '2026-04-24T08:39:51+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (49, 2, 7, 3, 13, 'Autobahnfahrt', 'student', '2026-05-04T16:15:00+00:00', '2026-05-04T17:45:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-23T08:16:18+00:00', '2026-04-23T08:30:07+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (51, 2, 14, 3, 12, 'Überlandfahrt', 'student', '2026-05-05T07:00:00+00:00', '2026-05-05T07:45:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-23T08:17:45+00:00', '2026-05-04T06:37:04+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (52, 2, 14, 3, 12, 'Überlandfahrt', 'student', '2026-05-08T11:30:00+00:00', '2026-05-08T14:30:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-04-23T08:18:12+00:00', '2026-05-06T08:09:09+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (54, 2, 15, 3, 15, 'Übungsstunde', 'student', '2026-05-12T06:00:00+00:00', '2026-05-12T07:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T08:21:26+00:00', '2026-04-23T08:21:32+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (55, 2, 7, 3, 12, 'Überlandfahrt', 'student', '2026-04-28T12:30:00+00:00', '2026-04-28T14:00:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-23T08:29:26+00:00', '2026-04-23T08:29:26+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (56, 2, 7, 3, 15, 'Übungsstunde', 'student', '2026-05-04T17:45:00+00:00', '2026-05-04T18:30:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-23T08:30:16+00:00', '2026-04-23T08:30:16+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (57, 2, 7, 3, 15, 'Übungsstunde', 'student', '2026-04-28T11:00:00+00:00', '2026-04-28T12:30:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-23T08:30:35+00:00', '2026-04-23T08:30:35+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (58, 2, 10, 3, 15, 'Übungsstunde', 'student', '2026-04-23T17:00:00+00:00', '2026-04-23T18:30:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-23T08:34:06+00:00', '2026-04-23T08:34:10+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (59, 2, 15, 3, 16, 'Praktische Prüfung', 'student', '2026-05-13T08:50:00+00:00', '2026-05-13T10:05:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-23T09:04:23+00:00', '2026-05-07T11:54:19+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (61, 2, 3, 3, 16, 'Praktische Prüfung', 'student', '2026-05-05T12:15:00+00:00', '2026-05-05T13:30:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-23T09:06:24+00:00', '2026-05-04T06:36:24+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (62, 2, 7, 3, 16, 'Praktische Prüfung', 'student', '2026-05-05T11:00:00+00:00', '2026-05-05T12:15:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-23T09:06:47+00:00', '2026-05-04T18:38:20+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (63, 2, 11, 3, 12, 'Überlandfahrt', 'student', '2026-04-27T11:00:00+00:00', '2026-04-27T12:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-23T21:47:43+00:00', '2026-04-27T11:00:51+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (67, 2, 13, 3, 15, 'Übungsstunde', 'student', '2026-04-30T09:45:00+00:00', '2026-04-30T10:30:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T07:24:36+00:00', '2026-04-24T07:24:43+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (68, 2, 14, 3, 13, 'Autobahnfahrt', 'student', '2026-05-05T07:45:00+00:00', '2026-05-05T09:15:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-24T07:29:55+00:00', '2026-05-04T06:36:52+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (69, 2, 14, 3, 16, 'Praktische Prüfung', 'student', '2026-05-11T11:40:00+00:00', '2026-05-11T13:05:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-24T07:31:52+00:00', '2026-05-08T07:28:05+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (70, 2, 3, 3, 12, 'Überlandfahrt', 'student', '2026-04-28T15:00:00+00:00', '2026-04-28T15:45:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-24T07:42:39+00:00', '2026-04-24T07:42:39+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (72, 2, 13, 3, 16, 'Praktische Prüfung', 'student', '2026-05-06T11:20:00+00:00', '2026-05-06T12:35:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T07:44:24+00:00', '2026-05-04T06:34:51+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (73, 2, 9, 3, 13, 'Autobahnfahrt', 'student', '2026-04-29T10:30:00+00:00', '2026-04-29T12:00:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-24T07:47:49+00:00', '2026-04-24T07:47:52+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (74, 2, 11, 3, 16, 'Praktische Prüfung', 'student', '2026-05-06T10:15:00+00:00', '2026-05-06T11:40:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-24T07:48:36+00:00', '2026-05-07T11:48:54+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (76, 2, 11, 3, 15, 'Übungsstunde', 'student', '2026-04-27T12:30:00+00:00', '2026-04-27T13:15:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T07:49:49+00:00', '2026-04-27T12:05:20+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (78, 2, NULL, 3, 17, 'Privat', 'private', '2026-04-30T06:00:00+00:00', '2026-04-30T08:15:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-24T07:59:59+00:00', '2026-04-24T08:02:57+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (80, 2, 17, 3, 12, 'Überlandfahrt', 'student', '2026-04-30T15:00:00+00:00', '2026-04-30T16:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-24T08:01:22+00:00', '2026-04-24T08:42:10+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (81, 2, 11, 3, 12, 'Überlandfahrt', 'student', '2026-04-29T08:00:00+00:00', '2026-04-29T08:45:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T08:10:10+00:00', '2026-04-24T08:10:20+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (82, 2, 9, 3, 16, 'Praktische Prüfung', 'student', '2026-05-06T08:50:00+00:00', '2026-05-06T10:15:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-24T08:10:58+00:00', '2026-05-07T11:48:41+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (83, 2, 11, 3, 12, 'Überlandfahrt', 'student', '2026-05-05T14:00:00+00:00', '2026-05-05T15:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-24T08:11:27+00:00', '2026-05-05T07:13:35+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (86, 2, 6, 3, 16, 'Praktische Prüfung', 'student', '2026-05-05T09:45:00+00:00', '2026-05-05T11:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T08:18:47+00:00', '2026-05-04T06:35:48+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (87, 2, 9, 3, 11, 'Nachtfahrten', 'student', '2026-04-25T18:30:00+00:00', '2026-04-25T20:45:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-24T08:25:38+00:00', '2026-04-24T08:39:40+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (88, 2, NULL, 3, 20, 'Wechselfahrt', 'work', '2026-04-23T11:45:00+00:00', '2026-04-23T12:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-24T09:12:32+00:00', '2026-04-24T09:12:32+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (89, 2, NULL, 3, 21, 'Sonstige Taetigkeit', 'work', '2026-04-23T18:30:00+00:00', '2026-04-23T19:30:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-04-24T09:13:12+00:00', '2026-04-24T09:13:12+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (91, 2, 15, 3, 15, 'Übungsstunde', 'student', '2026-05-11T08:30:00+00:00', '2026-05-11T10:45:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-04-27T07:08:36+00:00', '2026-05-08T07:28:16+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (92, 2, 15, 3, 12, 'Überlandfahrt', 'student', '2026-05-12T07:30:00+00:00', '2026-05-12T09:00:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-04-27T07:09:19+00:00', '2026-04-27T07:09:19+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (95, 2, 17, 3, 15, 'Übungsstunde', 'student', '2026-05-02T17:30:00+00:00', '2026-05-02T18:15:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-04-28T10:51:37+00:00', '2026-04-28T10:51:37+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (96, 2, 9, 3, 12, 'Überlandfahrt', 'student', '2026-05-04T09:30:00+00:00', '2026-05-04T11:00:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-04-29T19:22:31+00:00', '2026-04-29T19:22:48+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (97, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-08T00:15:00+00:00', '2026-05-08T11:30:00+00:00', 11, 'planned', '', 1, 6, 6, '2026-05-05T19:28:33+00:00', '2026-05-05T19:28:33+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (99, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-19T09:00:00+00:00', '2026-05-19T10:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-06T16:05:05+00:00', '2026-05-06T16:05:05+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (100, 2, 22, 3, 11, 'Nachtfahrten', 'student', '2026-05-07T18:30:00+00:00', '2026-05-07T20:45:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-07T11:36:23+00:00', '2026-05-07T12:03:24+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (101, 2, 20, 3, 14, 'Einweisung', 'student', '2026-05-07T15:45:00+00:00', '2026-05-07T16:30:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-07T11:36:40+00:00', '2026-05-07T12:12:40+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (102, 2, 20, 3, 15, 'Übungsstunde', 'student', '2026-05-08T15:00:00+00:00', '2026-05-08T17:15:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-07T11:37:51+00:00', '2026-05-13T10:31:47+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (103, 2, 17, 3, 16, 'Praktische Prüfung', 'student', '2026-05-06T12:30:00+00:00', '2026-05-06T13:55:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-05-07T11:48:01+00:00', '2026-05-07T11:48:31+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (104, 2, 20, 3, 15, 'Übungsstunde', 'student', '2026-05-07T16:30:00+00:00', '2026-05-07T18:00:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-07T12:12:48+00:00', '2026-05-07T12:13:08+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (108, 2, NULL, 3, 20, 'Wechselfahrt', 'work', '2026-05-11T13:00:00+00:00', '2026-05-11T14:00:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-05-08T07:29:03+00:00', '2026-05-08T07:29:03+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (110, 2, NULL, 3, 20, 'Wechselfahrt', 'work', '2026-05-13T10:00:00+00:00', '2026-05-13T11:00:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-05-08T07:30:18+00:00', '2026-05-08T07:30:18+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (116, 2, 20, 3, 15, 'Übungsstunde', 'student', '2026-05-13T11:15:00+00:00', '2026-05-13T12:45:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-08T07:39:55+00:00', '2026-05-13T10:32:15+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (119, 2, 21, 3, 14, 'Einweisung', 'student', '2026-05-12T09:15:00+00:00', '2026-05-12T10:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-08T07:45:42+00:00', '2026-05-09T13:43:04+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (120, 2, 21, 3, 14, 'Einweisung', 'student', '2026-05-12T10:00:00+00:00', '2026-05-12T11:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-08T07:45:50+00:00', '2026-05-09T13:43:18+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (123, 2, 19, 3, 14, 'Einweisung', 'student', '2026-05-12T12:00:00+00:00', '2026-05-12T12:45:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-05-09T13:45:05+00:00', '2026-05-09T13:45:05+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (124, 2, 19, 3, 15, 'Übungsstunde', 'student', '2026-05-12T12:45:00+00:00', '2026-05-12T14:15:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-05-09T13:45:20+00:00', '2026-05-09T13:45:20+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (125, 2, 23, 3, 14, 'Einweisung', 'student', '2026-05-13T05:30:00+00:00', '2026-05-13T06:15:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-11T17:45:00+00:00', '2026-05-11T17:47:29+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (126, 2, 23, 3, 15, 'Übungsstunde', 'student', '2026-05-13T06:15:00+00:00', '2026-05-13T07:45:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-11T17:47:35+00:00', '2026-05-13T07:03:13+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (128, 2, 20, 3, 11, 'Nachtfahrten', 'student', '2026-05-15T18:00:00+00:00', '2026-05-15T20:15:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-11T17:50:12+00:00', '2026-05-13T14:12:08+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (130, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-16T09:00:00+00:00', '2026-05-16T10:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-11T17:52:04+00:00', '2026-05-11T17:52:24+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (131, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-16T10:45:00+00:00', '2026-05-16T12:15:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-11T17:52:33+00:00', '2026-05-11T17:52:33+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (133, 2, NULL, 3, 21, 'Sonstige Taetigkeit', 'work', '2026-05-11T10:45:00+00:00', '2026-05-11T11:30:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-11T18:09:30+00:00', '2026-05-11T18:09:30+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (134, 2, NULL, 3, 21, 'Sonstige Taetigkeit', 'work', '2026-05-13T08:00:00+00:00', '2026-05-13T08:45:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-11T18:09:58+00:00', '2026-05-11T18:10:10+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (136, 2, 20, 3, 12, 'Überlandfahrt', 'student', '2026-05-13T12:45:00+00:00', '2026-05-13T14:15:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-05-13T10:32:27+00:00', '2026-05-13T10:32:27+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (137, 2, 19, 3, 15, 'Übungsstunde', 'student', '2026-05-15T14:45:00+00:00', '2026-05-15T17:45:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-13T10:34:50+00:00', '2026-05-14T12:29:05+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (138, 2, 19, 3, 11, 'Nachtfahrten', 'student', '2026-05-22T18:00:00+00:00', '2026-05-22T20:15:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-14T12:15:48+00:00', '2026-05-14T12:15:48+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (139, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-18T15:00:00+00:00', '2026-05-18T19:00:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:16:59+00:00', '2026-05-14T12:17:16+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (140, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-20T15:00:00+00:00', '2026-05-20T19:00:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:17:10+00:00', '2026-05-14T12:17:13+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (141, 2, 23, 3, 15, 'Übungsstunde', 'student', '2026-05-19T05:30:00+00:00', '2026-05-19T08:30:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:21:43+00:00', '2026-05-14T12:22:57+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (142, 2, 22, 3, 14, 'Einweisung', 'student', '2026-05-22T11:30:00+00:00', '2026-05-22T14:30:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:24:02+00:00', '2026-05-14T12:25:48+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (144, 2, 19, 3, 15, 'Übungsstunde', 'student', '2026-05-27T12:00:00+00:00', '2026-05-27T12:45:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-14T12:31:05+00:00', '2026-05-14T12:41:13+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (145, 2, 19, 3, 12, 'Überlandfahrt', 'student', '2026-05-27T12:45:00+00:00', '2026-05-27T15:00:00+00:00', 3, 'planned', '', 1, 6, 6, '2026-05-14T12:31:42+00:00', '2026-05-14T12:41:18+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (146, 2, 19, 3, 16, 'Praktische Prüfung', 'student', '2026-06-01T06:00:00+00:00', '2026-06-01T07:25:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-14T12:31:59+00:00', '2026-05-14T12:31:59+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (147, 2, 22, 3, 16, 'Praktische Prüfung', 'student', '2026-06-01T07:45:00+00:00', '2026-06-01T09:10:00+00:00', 1, 'planned', '', 1, 6, 6, '2026-05-14T12:32:51+00:00', '2026-05-14T12:32:51+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (148, 2, 19, 3, 12, 'Überlandfahrt', 'student', '2026-05-28T12:00:00+00:00', '2026-05-28T13:30:00+00:00', 2, 'planned', '', 0, 6, 6, '2026-05-14T12:33:31+00:00', '2026-05-14T12:33:31+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (149, 2, 19, 3, 13, 'Autobahnfahrt', 'student', '2026-05-28T13:30:00+00:00', '2026-05-28T15:00:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-05-14T12:33:43+00:00', '2026-05-14T12:33:43+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (150, 2, 3, 3, 15, 'Übungsstunde', 'student', '2026-05-26T11:00:00+00:00', '2026-05-26T14:00:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:37:39+00:00', '2026-05-14T12:41:57+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (151, 2, NULL, 3, 17, 'Privat', 'private', '2026-05-26T15:00:00+00:00', '2026-05-26T16:00:00+00:00', 1, 'planned', '', 0, 6, 6, '2026-05-14T12:41:38+00:00', '2026-05-14T12:41:38+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (152, 2, 15, 3, 14, 'Einweisung', 'student', '2026-05-22T14:45:00+00:00', '2026-05-22T17:45:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-14T12:46:48+00:00', '2026-05-14T12:46:48+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (154, 2, 22, 3, 15, 'Übungsstunde', 'student', '2026-05-29T06:30:00+00:00', '2026-05-29T09:30:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-15T10:50:45+00:00', '2026-05-15T10:51:24+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (155, 2, 20, 3, 12, 'Überlandfahrt', 'student', '2026-05-19T10:30:00+00:00', '2026-05-19T12:45:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-15T20:50:25+00:00', '2026-05-15T20:50:36+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (156, 2, 20, 3, 13, 'Autobahnfahrt', 'student', '2026-05-21T11:45:00+00:00', '2026-05-21T13:15:00+00:00', 2, 'planned', '', 1, 6, 6, '2026-05-15T20:50:59+00:00', '2026-05-15T20:54:45+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (157, 2, 20, 3, 15, 'Übungsstunde', 'student', '2026-05-21T06:00:00+00:00', '2026-05-21T09:00:00+00:00', 4, 'planned', '', 0, 6, 6, '2026-05-15T20:51:35+00:00', '2026-05-15T20:54:04+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (158, 2, 20, 3, 15, 'Übungsstunde', 'student', '2026-05-21T09:15:00+00:00', '2026-05-21T11:30:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-15T20:51:41+00:00', '2026-05-15T20:54:19+00:00'); +INSERT INTO appointments (id, tenant_id, student_id, instructor_id, lesson_type_id, title, category, start_at, end_at, units, status, notes, warning_acknowledged, created_by, updated_by, created_at, updated_at) VALUES (159, 2, 14, 3, 14, 'Einweisung', 'student', '2026-05-18T11:30:00+00:00', '2026-05-18T14:00:00+00:00', 3, 'planned', '', 0, 6, 6, '2026-05-18T14:07:24+00:00', '2026-05-18T14:07:24+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (16, 14, 'C::lesson_type_15', 'Übungsstunde', 3, '2026-04-23T07:19:46+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (44, 11, 'lesson_type_15', 'Übungsstunde', 2, '2026-04-23T07:38:40+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (59, 44, 'lesson_type_13', 'Autobahnfahrt', 2, '2026-04-23T08:16:03+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (66, 54, 'lesson_type_15', 'Übungsstunde', 2, '2026-04-23T08:21:32+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (68, 55, 'lesson_type_12', 'Überlandfahrt', 2, '2026-04-23T08:29:26+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (69, 49, 'lesson_type_13', 'Autobahnfahrt', 2, '2026-04-23T08:30:07+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (70, 56, 'lesson_type_15', 'Übungsstunde', 1, '2026-04-23T08:30:16+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (71, 57, 'lesson_type_15', 'Übungsstunde', 2, '2026-04-23T08:30:35+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (74, 58, 'C::lesson_type_15', 'Übungsstunde', 2, '2026-04-23T08:34:10+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (75, 15, 'C::lesson_type_14', 'Einweisung', 1, '2026-04-23T08:34:15+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (88, 19, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-04-24T06:56:17+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (101, 23, 'C::lesson_type_12', 'Überlandfahrt', 3, '2026-04-24T07:24:01+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (103, 39, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-04-24T07:24:28+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (105, 67, 'C::lesson_type_15', 'Übungsstunde', 1, '2026-04-24T07:24:43+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (109, 20, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-04-24T07:30:07+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (114, 40, 'C::lesson_type_15', 'Übungsstunde', 4, '2026-04-24T07:33:13+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (116, 22, 'lesson_type_15', 'Übungsstunde', 4, '2026-04-24T07:36:25+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (118, 27, 'lesson_type_12', 'Überlandfahrt', 2, '2026-04-24T07:41:27+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (119, 24, 'lesson_type_15', 'Übungsstunde', 1, '2026-04-24T07:42:24+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (120, 70, 'lesson_type_12', 'Überlandfahrt', 1, '2026-04-24T07:42:39+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (123, 18, 'C::lesson_type_15', 'Übungsstunde', 3, '2026-04-24T07:43:59+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (125, 25, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-04-24T07:47:37+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (127, 73, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-04-24T07:47:52+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (134, 41, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-04-24T08:01:06+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (137, 28, 'C::lesson_type_12', 'Überlandfahrt', 3, '2026-04-24T08:02:02+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (139, 26, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-04-24T08:10:04+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (141, 81, 'C::lesson_type_12', 'Überlandfahrt', 1, '2026-04-24T08:10:20+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (150, 17, 'lesson_type_15', 'Übungsstunde', 3, '2026-04-24T08:19:09+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (165, 87, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-04-24T08:39:40+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (166, 46, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-04-24T08:39:51+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (168, 80, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-04-24T08:42:10+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (169, 16, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-04-24T09:12:56+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (175, 92, 'lesson_type_12', 'Überlandfahrt', 2, '2026-04-27T07:09:19+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (176, 63, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-04-27T11:00:51+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (179, 76, 'C::lesson_type_15', 'Übungsstunde', 1, '2026-04-27T12:05:20+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (183, 43, 'lesson_type_12', 'Überlandfahrt', 4, '2026-04-27T13:38:49+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (188, 95, 'C::lesson_type_15', 'Übungsstunde', 1, '2026-04-28T10:51:37+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (191, 96, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-04-29T19:22:48+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (218, 72, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-04T06:34:51+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (221, 86, 'lesson_type_16', 'Praktische Prüfung', 1, '2026-05-04T06:35:48+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (224, 61, 'lesson_type_16', 'Praktische Prüfung', 1, '2026-05-04T06:36:24+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (226, 68, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-05-04T06:36:52+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (227, 51, 'C::lesson_type_12', 'Überlandfahrt', 1, '2026-05-04T06:37:04+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (230, 62, 'lesson_type_16', 'Praktische Prüfung', 1, '2026-05-04T18:38:20+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (231, 83, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-05-05T07:13:35+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (234, 52, 'C::lesson_type_12', 'Überlandfahrt', 4, '2026-05-06T08:09:09+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (242, 103, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-07T11:48:31+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (243, 82, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-07T11:48:41+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (244, 74, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-07T11:48:54+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (250, 59, 'lesson_type_16', 'Praktische Prüfung', 1, '2026-05-07T11:54:19+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (253, 100, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-05-07T12:03:24+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (255, 101, 'C::lesson_type_14', 'Einweisung', 1, '2026-05-07T12:12:40+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (257, 104, 'C::lesson_type_15', 'Übungsstunde', 2, '2026-05-07T12:13:08+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (258, 69, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-08T07:28:05+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (259, 91, 'lesson_type_15', 'Übungsstunde', 3, '2026-05-08T07:28:16+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (284, 119, 'lesson_type_14', 'Einweisung', 1, '2026-05-09T13:43:04+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (285, 120, 'lesson_type_14', 'Einweisung', 2, '2026-05-09T13:43:18+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (286, 123, 'C::lesson_type_14', 'Einweisung', 1, '2026-05-09T13:45:05+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (287, 124, 'C::lesson_type_15', 'Übungsstunde', 2, '2026-05-09T13:45:20+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (291, 125, 'C::lesson_type_14', 'Einweisung', 1, '2026-05-11T17:47:29+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (301, 126, 'C::lesson_type_15', 'Übungsstunde', 2, '2026-05-13T07:03:13+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (304, 102, 'C::lesson_type_15', 'Übungsstunde', 3, '2026-05-13T10:31:47+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (305, 116, 'C::lesson_type_15', 'Übungsstunde', 2, '2026-05-13T10:32:15+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (306, 136, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-05-13T10:32:27+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (309, 128, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-05-13T14:12:08+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (313, 138, 'C::lesson_type_11', 'Nachtfahrten', 3, '2026-05-14T12:15:48+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (319, 141, 'C::lesson_type_15', 'Übungsstunde', 4, '2026-05-14T12:22:57+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (328, 142, 'C::lesson_type_14', 'Einweisung', 4, '2026-05-14T12:25:48+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (330, 137, 'C::lesson_type_15', 'Übungsstunde', 4, '2026-05-14T12:29:05+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (335, 146, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-14T12:31:59+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (336, 147, 'C::lesson_type_16', 'Praktische Prüfung', 1, '2026-05-14T12:32:51+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (337, 148, 'C::lesson_type_12', 'Überlandfahrt', 2, '2026-05-14T12:33:31+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (338, 149, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-05-14T12:33:43+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (341, 144, 'C::lesson_type_15', 'Übungsstunde', 1, '2026-05-14T12:41:13+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (342, 145, 'C::lesson_type_12', 'Überlandfahrt', 3, '2026-05-14T12:41:18+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (344, 150, 'lesson_type_15', 'Übungsstunde', 4, '2026-05-14T12:41:57+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (345, 152, 'lesson_type_14', 'Einweisung', 4, '2026-05-14T12:46:48+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (349, 154, 'C::lesson_type_15', 'Übungsstunde', 4, '2026-05-15T10:51:24+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (352, 155, 'C::lesson_type_12', 'Überlandfahrt', 3, '2026-05-15T20:50:36+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (359, 157, 'C::lesson_type_15', 'Übungsstunde', 4, '2026-05-15T20:54:04+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (360, 158, 'C::lesson_type_15', 'Übungsstunde', 3, '2026-05-15T20:54:19+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (362, 156, 'C::lesson_type_13', 'Autobahnfahrt', 2, '2026-05-15T20:54:45+00:00'); +INSERT INTO appointment_units (id, appointment_id, requirement_key, label, units_counted, created_at) VALUES (363, 159, 'C::lesson_type_14', 'Einweisung', 3, '2026-05-18T14:07:24+00:00'); +INSERT INTO settings (id, tenant_id, key_name, value) VALUES (1, 1, 'app.theme', 'signal'); \ No newline at end of file diff --git a/www/fahrschultermin.de/database/schema_pgsql.sql b/www/fahrschultermin.de/database/schema_pgsql.sql new file mode 100644 index 0000000..34204d1 --- /dev/null +++ b/www/fahrschultermin.de/database/schema_pgsql.sql @@ -0,0 +1,166 @@ +-- PostgreSQL Schema for fahrschultermin.de +-- Run this BEFORE importing data + +BEGIN; + +-- ── Tenants ─────────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS tenants ( + id BIGSERIAL PRIMARY KEY, + name TEXT NOT NULL, + timezone TEXT NOT NULL DEFAULT 'Europe/Berlin', + is_active INTEGER NOT NULL DEFAULT 1, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + location_label TEXT DEFAULT '', + latitude DOUBLE PRECISION DEFAULT NULL, + longitude DOUBLE PRECISION DEFAULT NULL, + federal_state TEXT DEFAULT 'BE' +); + +-- ── Users ───────────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS users ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT REFERENCES tenants(id) ON DELETE CASCADE, + role TEXT NOT NULL, + email TEXT NOT NULL UNIQUE, + password_hash TEXT NOT NULL, + first_name TEXT NOT NULL, + last_name TEXT NOT NULL, + is_active INTEGER NOT NULL DEFAULT 1, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL +); + +-- ── Instructors ──────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS instructors ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + first_name TEXT NOT NULL, + last_name TEXT NOT NULL, + color TEXT NOT NULL, + notes TEXT DEFAULT '', + is_active INTEGER NOT NULL DEFAULT 1, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + user_id BIGINT REFERENCES users(id) ON DELETE SET NULL, + pre_start_buffer_minutes INTEGER NOT NULL DEFAULT 0 +); + +-- ── License Class Templates ─────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS license_class_templates ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + code TEXT NOT NULL, + name TEXT NOT NULL, + is_combination INTEGER NOT NULL DEFAULT 0, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + UNIQUE (tenant_id, code) +); + +-- ── License Template Requirements ───────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS license_template_requirements ( + id BIGSERIAL PRIMARY KEY, + template_id BIGINT NOT NULL REFERENCES license_class_templates(id) ON DELETE CASCADE, + requirement_key TEXT NOT NULL, + label TEXT NOT NULL, + required_units INTEGER NOT NULL, + sort_order INTEGER NOT NULL DEFAULT 0, + phase_label TEXT NOT NULL DEFAULT '' +); + +-- ── Lesson Types ────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS lesson_types ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + name TEXT NOT NULL, + color TEXT NOT NULL, + default_duration INTEGER NOT NULL, + category TEXT NOT NULL, + requirement_key TEXT DEFAULT NULL, + is_billable INTEGER NOT NULL DEFAULT 0, + is_counted INTEGER NOT NULL DEFAULT 0, + is_rest_relevant INTEGER NOT NULL DEFAULT 0, + fixed_duration INTEGER NOT NULL DEFAULT 0, + sort_order INTEGER NOT NULL DEFAULT 0, + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + system_key TEXT DEFAULT NULL +); + +-- ── Lesson Type ↔ Template Visibility ────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS lesson_type_template_visibility ( + lesson_type_id BIGINT NOT NULL REFERENCES lesson_types(id) ON DELETE CASCADE, + template_id BIGINT NOT NULL REFERENCES license_class_templates(id) ON DELETE CASCADE, + PRIMARY KEY (lesson_type_id, template_id) +); + +-- ── Students ────────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS students ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + template_id BIGINT NOT NULL REFERENCES license_class_templates(id), + first_name TEXT NOT NULL, + last_name TEXT NOT NULL, + phone TEXT DEFAULT '', + notes TEXT DEFAULT '', + status TEXT NOT NULL DEFAULT 'active', + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL, + email TEXT NOT NULL DEFAULT '', + needs_glasses INTEGER NOT NULL DEFAULT 0 +); + +-- ── Student Requirement Snapshots ────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS student_requirement_snapshots ( + id BIGSERIAL PRIMARY KEY, + student_id BIGINT NOT NULL REFERENCES students(id) ON DELETE CASCADE, + requirement_key TEXT NOT NULL, + label TEXT NOT NULL, + required_units INTEGER NOT NULL, + sort_order INTEGER NOT NULL DEFAULT 0, + prior_completed_units INTEGER NOT NULL DEFAULT 0, + phase_label TEXT NOT NULL DEFAULT '' +); + +-- ── Appointments ────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS appointments ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + student_id BIGINT REFERENCES students(id) ON DELETE SET NULL, + instructor_id BIGINT NOT NULL REFERENCES instructors(id), + lesson_type_id BIGINT NOT NULL REFERENCES lesson_types(id), + title TEXT NOT NULL, + category TEXT NOT NULL, + start_at TIMESTAMPTZ NOT NULL, + end_at TIMESTAMPTZ NOT NULL, + units INTEGER NOT NULL DEFAULT 1, + status TEXT NOT NULL DEFAULT 'planned', + notes TEXT DEFAULT '', + warning_acknowledged INTEGER NOT NULL DEFAULT 0, + created_by BIGINT NOT NULL REFERENCES users(id), + updated_by BIGINT NOT NULL REFERENCES users(id), + created_at TIMESTAMPTZ NOT NULL, + updated_at TIMESTAMPTZ NOT NULL +); + +-- ── Appointment Units ───────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS appointment_units ( + id BIGSERIAL PRIMARY KEY, + appointment_id BIGINT NOT NULL REFERENCES appointments(id) ON DELETE CASCADE, + requirement_key TEXT DEFAULT NULL, + label TEXT DEFAULT NULL, + units_counted INTEGER NOT NULL DEFAULT 0, + created_at TIMESTAMPTZ NOT NULL +); + +-- ── Settings ─────────────────────────────────────────────────────────────────── +CREATE TABLE IF NOT EXISTS settings ( + id BIGSERIAL PRIMARY KEY, + tenant_id BIGINT NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + key_name TEXT NOT NULL, + value TEXT NOT NULL, + UNIQUE (tenant_id, key_name) +); + +COMMIT; \ No newline at end of file diff --git a/www/fahrschultermin.de/public/.htaccess b/www/fahrschultermin.de/public/.htaccess index 66ef8f6..7675a5d 100644 --- a/www/fahrschultermin.de/public/.htaccess +++ b/www/fahrschultermin.de/public/.htaccess @@ -1,4 +1,9 @@ RewriteEngine On + +# Proxy API requests to api.fahrschultermin.de +RewriteRule ^api/v1/(.*)$ https://api.fahrschultermin.de/api/v1/$1 [P,L] + +# Serve static assets directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^ index.php [QSA,L] +RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/www/fahrschultermin.de/public/index.php b/www/fahrschultermin.de/public/index.php index 3fbfe27..6618499 100644 --- a/www/fahrschultermin.de/public/index.php +++ b/www/fahrschultermin.de/public/index.php @@ -1,74 +1,12 @@ path(); - -if ($request->method() === 'OPTIONS') { - http_response_code(204); - exit; -} - -if (str_starts_with($path, '/api/v1')) { - $auth = new AuthController(); - $bootstrapController = new BootstrapController(); - $students = new StudentsController(); - $references = new ReferenceDataController(); - $appointments = new AppointmentsController(); - $users = new UsersController(); - $tenants = new TenantsController(); - $instructors = new InstructorsController(); - - $router->post('/api/v1/auth/login', [$auth, 'login']); - $router->post('/api/v1/auth/logout', [$auth, 'logout']); - $router->get('/api/v1/auth/me', [$auth, 'me']); - $router->get('/api/v1/bootstrap', $bootstrapController); - $router->get('/api/v1/students', [$students, 'index']); - $router->post('/api/v1/students', [$students, 'store']); - $router->patch('/api/v1/students/{id}/training', [$students, 'updateTraining']); - $router->patch('/api/v1/students/{id}', [$students, 'update']); - $router->delete('/api/v1/students/{id}', [$students, 'destroy']); - $router->get('/api/v1/lesson-types', [$references, 'lessonTypes']); - $router->post('/api/v1/lesson-types', [$references, 'storeLessonType']); - $router->post('/api/v1/lesson-types/reorder', [$references, 'reorderLessonTypes']); - $router->patch('/api/v1/lesson-types/{id}', [$references, 'updateLessonType']); - $router->delete('/api/v1/lesson-types/{id}', [$references, 'destroyLessonType']); - $router->post('/api/v1/lesson-types/visibility', [$references, 'updateLessonTypeMatrix']); - $router->get('/api/v1/license-class-templates', [$references, 'templates']); - $router->post('/api/v1/license-class-templates', [$references, 'storeTemplate']); - $router->patch('/api/v1/license-class-templates/{id}', [$references, 'updateTemplate']); - $router->get('/api/v1/instructors', [$instructors, 'index']); - $router->post('/api/v1/instructors', [$instructors, 'store']); - $router->patch('/api/v1/instructors/{id}', [$instructors, 'update']); - $router->get('/api/v1/users', [$users, 'index']); - $router->post('/api/v1/users', [$users, 'store']); - $router->patch('/api/v1/users/{id}', [$users, 'update']); - $router->get('/api/v1/tenants', [$tenants, 'index']); - $router->post('/api/v1/tenants', [$tenants, 'store']); - $router->patch('/api/v1/tenants/{id}', [$tenants, 'update']); - $router->patch('/api/v1/tenant/profile', [$tenants, 'updateOwn']); - $router->get('/api/v1/appointments', [$appointments, 'index']); - $router->post('/api/v1/appointments/validate', [$appointments, 'validate']); - $router->post('/api/v1/appointments', [$appointments, 'store']); - $router->patch('/api/v1/appointments/{id}', [$appointments, 'update']); - $router->delete('/api/v1/appointments/{id}', [$appointments, 'destroy']); - - $router->dispatch(); - exit; -} +const API_BASE = 'https://api.fahrschultermin.de'; $assetManifestPath = __DIR__ . '/assets/.vite/manifest.json'; $mainAsset = '/assets/index.js'; @@ -95,6 +33,21 @@ if (is_file($assetManifestPath)) {
+ -