feat: Provisionner automatiquement un nouvel établissement
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled

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:
2026-04-08 13:55:41 +02:00
parent bec211ebf0
commit e72867932d
107 changed files with 9709 additions and 383 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Infrastructure\Api\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\EvaluationDifficultyProvider;
#[ApiResource(
shortName: 'EvaluationDifficulty',
operations: [
new Get(
uriTemplate: '/me/statistics/evaluations',
provider: EvaluationDifficultyProvider::class,
name: 'get_evaluation_difficulty',
),
],
)]
final class EvaluationDifficultyResource
{
#[ApiProperty(identifier: true)]
public string $teacherId = 'me';
/** @var list<array{evaluationId: string, title: string, classId: string, className: string, subjectId: string, subjectName: string, date: string, average: float|null, gradedCount: int, subjectAverage: float|null, percentile: float|null}> */
public array $evaluations = [];
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Infrastructure\Api\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\StudentProgressionProvider;
#[ApiResource(
shortName: 'StudentProgression',
operations: [
new Get(
uriTemplate: '/me/statistics/students/{studentId}',
provider: StudentProgressionProvider::class,
name: 'get_student_progression',
),
],
)]
final class StudentProgressionResource
{
#[ApiProperty(identifier: true)]
public ?string $studentId = null;
public ?string $subjectId = null;
public ?string $classId = null;
/** @var list<array{date: string, value: float, evaluationTitle: string}> */
public array $grades = [];
/** @var array{slope: float, intercept: float}|null */
public ?array $trendLine = null;
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Infrastructure\Api\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\TeacherClassStatisticsProvider;
#[ApiResource(
shortName: 'TeacherClassStatistics',
operations: [
new Get(
uriTemplate: '/me/statistics/classes/{classId}',
provider: TeacherClassStatisticsProvider::class,
name: 'get_teacher_class_statistics',
),
],
)]
final class TeacherClassStatisticsResource
{
#[ApiProperty(identifier: true)]
public ?string $classId = null;
public ?string $subjectId = null;
public ?float $average = null;
public float $successRate = 0.0;
/** @var list<int> */
public array $distribution = [];
/** @var list<array{month: string, average: float}> */
public array $evolution = [];
/** @var list<array{studentId: string, studentName: string, average: float|null, inDifficulty: bool, trend: string}> */
public array $students = [];
}

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Infrastructure\Api\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\TeacherStatisticsExportProvider;
#[ApiResource(
shortName: 'TeacherStatisticsExport',
operations: [
new Get(
uriTemplate: '/me/statistics/export',
provider: TeacherStatisticsExportProvider::class,
name: 'get_teacher_statistics_export',
),
],
)]
final class TeacherStatisticsExportResource
{
#[ApiProperty(identifier: true)]
public string $id = 'export';
public string $format = 'csv';
public string $content = '';
public string $filename = '';
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace App\Scolarite\Infrastructure\Api\Resource;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Scolarite\Infrastructure\Api\Provider\TeacherStatisticsOverviewProvider;
#[ApiResource(
shortName: 'TeacherStatisticsOverview',
operations: [
new Get(
uriTemplate: '/me/statistics',
provider: TeacherStatisticsOverviewProvider::class,
name: 'get_teacher_statistics_overview',
),
],
)]
final class TeacherStatisticsOverviewResource
{
#[ApiProperty(identifier: true)]
public string $teacherId = 'me';
public ?string $periodId = null;
/** @var list<array{classId: string, className: string, subjectId: string, subjectName: string, evaluationCount: int, studentCount: int, average: float|null, successRate: float|null}> */
public array $classes = [];
}