feat: Initial commit for Saqel Platform architecture, backend, Docker, and documentation

This commit is contained in:
Hamza-Ayed
2026-08-26 15:45:55 +03:00
commit d53b64500a
177 changed files with 19909 additions and 0 deletions
@@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GuardianSummaryController extends Controller
{
public function show(Request $request, User $student): JsonResponse
{
/** @var User $guardian */
$guardian = $request->user();
abort_unless($guardian->students()->whereKey($student->id)->exists(), 403);
$progress = $student->lessonProgress()
->with('lesson:id,title,course_id')
->latest('updated_at')
->limit(10)
->get()
->map(fn ($row): array => [
'lesson_id' => $row->lesson_id,
'lesson_title' => $row->lesson?->title,
'watched_percentage' => $row->watched_percentage,
'completed' => $row->completed_at !== null,
'last_active_at' => $row->updated_at->toIso8601String(),
]);
$weakestConcepts = $student->conceptMastery()
->with('concept:id,name')
->orderBy('mastery_score')
->limit(5)
->get()
->map(fn ($row): array => [
'concept' => $row->concept?->name,
'mastery_score' => (float) $row->mastery_score,
]);
$latestReport = $student->aiReports()
->where('type', 'weakness_analysis')
->latest()
->first();
return response()->json([
'student' => [
'id' => $student->id,
'name' => $student->name,
],
'lessons_progress' => $progress,
'weakest_concepts' => $weakestConcepts,
'latest_ai_summary' => $latestReport?->summary,
]);
}
}