feat: Provisionner automatiquement un nouvel établissement
Lorsqu'un super-admin crée un établissement via l'interface, le système doit automatiquement créer la base tenant, exécuter les migrations, créer le premier utilisateur admin et envoyer l'invitation — le tout de manière asynchrone pour ne pas bloquer la réponse HTTP. Ce mécanisme rend chaque établissement opérationnel dès sa création sans intervention manuelle sur l'infrastructure.
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Scolarite\Infrastructure\ReadModel;
|
||||
|
||||
use App\Scolarite\Application\Port\TeacherStatisticsReader;
|
||||
|
||||
final class InMemoryTeacherStatisticsReader implements TeacherStatisticsReader
|
||||
{
|
||||
/** @var list<array{classId: string, className: string, subjectId: string, subjectName: string, evaluationCount: int, studentCount: int, average: float|null, successRate: float|null}> */
|
||||
private array $classesSummary = [];
|
||||
|
||||
/** @var list<float> */
|
||||
private array $classGrades = [];
|
||||
|
||||
/** @var list<array{month: string, average: float}> */
|
||||
private array $monthlyAverages = [];
|
||||
|
||||
/** @var list<array{studentId: string, studentName: string, average: float|null}> */
|
||||
private array $studentAverages = [];
|
||||
|
||||
/** @var list<array{date: string, value: float, evaluationTitle: string}> */
|
||||
private array $gradeHistory = [];
|
||||
|
||||
/** @var list<array{evaluationId: string, title: string, classId: string, className: string, subjectId: string, subjectName: string, date: string, average: float|null, gradedCount: int}> */
|
||||
private array $evaluationDifficulties = [];
|
||||
|
||||
/** @var array<string, list<float>> */
|
||||
private array $studentMonthlyAverages = [];
|
||||
|
||||
/** @var list<float> */
|
||||
private array $otherTeachersAverages = [];
|
||||
|
||||
/** @param list<array{classId: string, className: string, subjectId: string, subjectName: string, evaluationCount: int, studentCount: int, average: float|null, successRate: float|null}> $data */
|
||||
public function feedClassesSummary(array $data): void
|
||||
{
|
||||
$this->classesSummary = $data;
|
||||
}
|
||||
|
||||
/** @param list<float> $grades */
|
||||
public function feedClassGrades(array $grades): void
|
||||
{
|
||||
$this->classGrades = $grades;
|
||||
}
|
||||
|
||||
/** @param list<array{month: string, average: float}> $averages */
|
||||
public function feedMonthlyAverages(array $averages): void
|
||||
{
|
||||
$this->monthlyAverages = $averages;
|
||||
}
|
||||
|
||||
/** @param list<array{studentId: string, studentName: string, average: float|null}> $averages */
|
||||
public function feedStudentAverages(array $averages): void
|
||||
{
|
||||
$this->studentAverages = $averages;
|
||||
}
|
||||
|
||||
/** @param list<array{date: string, value: float, evaluationTitle: string}> $history */
|
||||
public function feedGradeHistory(array $history): void
|
||||
{
|
||||
$this->gradeHistory = $history;
|
||||
}
|
||||
|
||||
/** @param list<array{evaluationId: string, title: string, classId: string, className: string, subjectId: string, subjectName: string, date: string, average: float|null, gradedCount: int}> $difficulties */
|
||||
public function feedEvaluationDifficulties(array $difficulties): void
|
||||
{
|
||||
$this->evaluationDifficulties = $difficulties;
|
||||
}
|
||||
|
||||
/** @param array<string, list<float>> $averages */
|
||||
public function feedStudentMonthlyAverages(array $averages): void
|
||||
{
|
||||
$this->studentMonthlyAverages = $averages;
|
||||
}
|
||||
|
||||
/** @param list<float> $averages */
|
||||
public function feedOtherTeachersAverages(array $averages): void
|
||||
{
|
||||
$this->otherTeachersAverages = $averages;
|
||||
}
|
||||
|
||||
public function teacherClassesSummary(string $teacherId, string $tenantId, string $periodStartDate, string $periodEndDate): array
|
||||
{
|
||||
return $this->classesSummary;
|
||||
}
|
||||
|
||||
public function classGradesNormalized(string $teacherId, string $classId, string $subjectId, string $tenantId, string $periodStartDate, string $periodEndDate): array
|
||||
{
|
||||
return $this->classGrades;
|
||||
}
|
||||
|
||||
public function classMonthlyAverages(string $teacherId, string $classId, string $subjectId, string $tenantId, string $academicYearStart, string $academicYearEnd): array
|
||||
{
|
||||
return $this->monthlyAverages;
|
||||
}
|
||||
|
||||
public function studentAveragesForClass(string $teacherId, string $classId, string $subjectId, string $periodId, string $tenantId): array
|
||||
{
|
||||
return $this->studentAverages;
|
||||
}
|
||||
|
||||
public function studentMonthlyAveragesForClass(string $classId, string $subjectId, string $tenantId, string $academicYearStart, string $academicYearEnd): array
|
||||
{
|
||||
return $this->studentMonthlyAverages;
|
||||
}
|
||||
|
||||
public function studentGradeHistory(string $studentId, string $subjectId, string $classId, string $teacherId, string $tenantId, string $academicYearStart, string $academicYearEnd): array
|
||||
{
|
||||
return $this->gradeHistory;
|
||||
}
|
||||
|
||||
public function teacherEvaluationDifficulties(string $teacherId, string $tenantId): array
|
||||
{
|
||||
return $this->evaluationDifficulties;
|
||||
}
|
||||
|
||||
public function subjectAveragesForOtherTeachers(string $teacherId, string $subjectId, string $tenantId): array
|
||||
{
|
||||
return $this->otherTeachersAverages;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user