Slim API deployment - composer install + full CRUD endpoints
This commit is contained in:
@@ -53,7 +53,6 @@ if (!is_dir($sessionPath)) {
|
||||
|
||||
session_save_path($sessionPath);
|
||||
|
||||
// SameSite=None only works with Secure (HTTPS). Fall back to Lax for local dev.
|
||||
$isHttps = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
|
||||
$sameSite = $isHttps ? 'None' : 'Lax';
|
||||
|
||||
@@ -80,6 +79,11 @@ use App\Http\Controllers\ReferenceDataController;
|
||||
use App\Http\Controllers\StudentsController;
|
||||
use App\Http\Controllers\TenantsController;
|
||||
use App\Http\Controllers\UsersController;
|
||||
use App\Http\Controllers\WorkTimesheetController;
|
||||
use App\Http\Controllers\StudentAuthController;
|
||||
use App\Http\Controllers\StudentController;
|
||||
use App\Http\Controllers\InstructorController;
|
||||
use App\Http\Controllers\TenantController;
|
||||
use App\Support\Request;
|
||||
use App\Support\Router;
|
||||
|
||||
@@ -97,10 +101,24 @@ if (str_starts_with($path, '/api/v1')) {
|
||||
$users = new UsersController();
|
||||
$tenants = new TenantsController();
|
||||
$instructors = new InstructorsController();
|
||||
$workTimesheet = new WorkTimesheetController();
|
||||
$studentAuth = new StudentAuthController();
|
||||
$student = new StudentController();
|
||||
$instructorCtrl = new InstructorController();
|
||||
$tenantCtrl = new TenantController();
|
||||
|
||||
// ── Auth (bestehend) ──────────────────────────────────────────────────────
|
||||
$router->post('/api/v1/auth/login', [$auth, 'login']);
|
||||
$router->post('/api/v1/auth/logout', [$auth, 'logout']);
|
||||
$router->get('/api/v1/auth/me', [$auth, 'me']);
|
||||
|
||||
// ── Student Auth (neu) ──────────────────────────────────────────────────────
|
||||
$router->post('/api/v1/auth/register-student', [$studentAuth, 'register']);
|
||||
|
||||
// ── Student me ─────────────────────────────────────────────────────────────
|
||||
$router->get('/api/v1/student/me', [$studentAuth, 'me']);
|
||||
|
||||
// ── Bootstrap + Reference ──────────────────────────────────────────────────
|
||||
$router->get('/api/v1/bootstrap', $bootstrapController);
|
||||
$router->get('/api/v1/students', [$students, 'index']);
|
||||
$router->post('/api/v1/students', [$students, 'store']);
|
||||
@@ -116,22 +134,85 @@ if (str_starts_with($path, '/api/v1')) {
|
||||
$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']);
|
||||
|
||||
// ── Instructors ────────────────────────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors', [$instructors, 'index']);
|
||||
$router->post('/api/v1/instructors', [$instructors, 'store']);
|
||||
$router->patch('/api/v1/instructors/{id}', [$instructors, 'update']);
|
||||
|
||||
// ── Instructor Settings (neu) ───────────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors/{id}/availability', [$instructorCtrl, 'availability']);
|
||||
$router->put('/api/v1/instructors/{id}/availability', [$instructorCtrl, 'availabilityUpdate']);
|
||||
$router->get('/api/v1/instructors/{id}/booking-settings', [$instructorCtrl, 'bookingSettings']);
|
||||
$router->patch('/api/v1/instructors/{id}/booking-settings', [$instructorCtrl, 'bookingSettingsUpdate']);
|
||||
|
||||
// ── Instructor Vacations ───────────────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors/{id}/vacations', [$instructorCtrl, 'vacations']);
|
||||
$router->post('/api/v1/instructors/{id}/vacations', [$instructorCtrl, 'vacationsCreate']);
|
||||
$router->delete('/api/v1/instructors/{id}/vacations/{vacation_id}', [$instructorCtrl, 'vacationsDelete']);
|
||||
|
||||
// ── Instructor Private Appointments ────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors/{id}/private-appointments', [$instructorCtrl, 'privateAppointments']);
|
||||
$router->post('/api/v1/instructors/{id}/private-appointments', [$instructorCtrl, 'privateAppointmentsCreate']);
|
||||
$router->delete('/api/v1/instructors/{id}/private-appointments/{priv_id}', [$instructorCtrl, 'privateAppointmentsDelete']);
|
||||
|
||||
// ── Instructor Multi-Tenant ─────────────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors/{id}/tenants', [$instructorCtrl, 'tenants']);
|
||||
$router->post('/api/v1/instructors/{id}/tenants', [$instructorCtrl, 'tenantsAdd']);
|
||||
$router->delete('/api/v1/instructors/{id}/tenants/{tenant_id}', [$instructorCtrl, 'tenantsRemove']);
|
||||
$router->get('/api/v1/instructors/{id}/travel-times', [$instructorCtrl, 'travelTimes']);
|
||||
$router->post('/api/v1/instructors/{id}/travel-times', [$instructorCtrl, 'travelTimesUpsert']);
|
||||
$router->delete('/api/v1/instructors/{id}/travel-times/{tt_id}', [$instructorCtrl, 'travelTimesDelete']);
|
||||
$router->get('/api/v1/instructors/{id}/home-to-tenant', [$instructorCtrl, 'homeToTenant']);
|
||||
$router->post('/api/v1/instructors/{id}/home-to-tenant', [$instructorCtrl, 'homeToTenantUpsert']);
|
||||
$router->delete('/api/v1/instructors/{id}/home-to-tenant/{ht_id}', [$instructorCtrl, 'homeToTenantDelete']);
|
||||
|
||||
// ── Instructor Break Rules ─────────────────────────────────────────────────
|
||||
$router->get('/api/v1/instructors/{id}/break-rules', [$instructorCtrl, 'breakRules']);
|
||||
$router->post('/api/v1/instructors/{id}/break-rules', [$instructorCtrl, 'breakRulesCreate']);
|
||||
$router->put('/api/v1/instructors/{id}/break-rules/{rule_id}', [$instructorCtrl, 'breakRulesUpdate']);
|
||||
$router->patch('/api/v1/instructors/{id}/break-rules/{rule_id}/toggle', [$instructorCtrl, 'breakRulesToggle']);
|
||||
$router->delete('/api/v1/instructors/{id}/break-rules/{rule_id}', [$instructorCtrl, 'breakRulesDelete']);
|
||||
|
||||
// ── Instructor Appointment Requests ─────────────────────────────────────────
|
||||
$router->get('/api/v1/instructor/appointment-requests', [$instructorCtrl, 'appointmentRequests']);
|
||||
$router->patch('/api/v1/instructor/appointment-requests/{id}/respond', [$instructorCtrl, 'appointmentRequestsRespond']);
|
||||
|
||||
// ── Users ───────────────────────────────────────────────────────────────────
|
||||
$router->get('/api/v1/users', [$users, 'index']);
|
||||
$router->post('/api/v1/users', [$users, 'store']);
|
||||
$router->patch('/api/v1/users/{id}', [$users, 'update']);
|
||||
|
||||
// ── Tenants ────────────────────────────────────────────────────────────────
|
||||
$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']);
|
||||
|
||||
// ── Tenant Admin (neu) ─────────────────────────────────────────────────────
|
||||
$router->get('/api/v1/tenant/pending-registrations', [$tenantCtrl, 'pendingRegistrations']);
|
||||
$router->patch('/api/v1/tenant/student-tenants/{id}/confirm', [$tenantCtrl, 'confirmStudentTenant']);
|
||||
$router->get('/api/v1/tenant/registration-code', [$tenantCtrl, 'getRegistrationCode']);
|
||||
$router->put('/api/v1/tenant/registration-code', [$tenantCtrl, 'updateRegistrationCode']);
|
||||
$router->patch('/api/v1/tenant/cancellation-settings', [$tenantCtrl, 'cancellationSettings']);
|
||||
|
||||
// ── Student Portal (neu) ──────────────────────────────────────────────────
|
||||
$router->get('/api/v1/student/instructors', [$student, 'instructors']);
|
||||
$router->get('/api/v1/student/instructors/{id}/slots', [$student, 'instructorSlots']);
|
||||
$router->post('/api/v1/student/appointment-requests', [$student, 'createAppointmentRequest']);
|
||||
$router->get('/api/v1/student/appointment-requests', [$student, 'appointmentRequests']);
|
||||
$router->post('/api/v1/student/add-tenant', [$student, 'addTenant']);
|
||||
|
||||
// ── Appointments ──────────────────────────────────────────────────────────
|
||||
$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']);
|
||||
|
||||
// ── Reports ───────────────────────────────────────────────────────────────
|
||||
$router->get('/api/v1/reports/work-timesheet', [$workTimesheet, 'index']);
|
||||
|
||||
$router->dispatch();
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user