feat: Permettre aux enseignants de créer et gérer les devoirs
Les enseignants avaient besoin d'un outil pour créer des devoirs assignés à leurs classes, avec filtrage automatique par matière selon la classe sélectionnée. Le système valide que la date d'échéance tombe un jour ouvrable (lundi-vendredi) et empêche les dates dans le passé. Le domaine modélise le devoir comme un agrégat avec pièces jointes, statut brouillon/publié, et événements métier (création, modification, suppression). Les handlers de notification écoutent ces événements pour les futurs envois aux parents et élèves.
This commit is contained in:
60
backend/migrations/Version20260312002349.php
Normal file
60
backend/migrations/Version20260312002349.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260312002349 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create homework and homework_attachments tables for Story 5.1';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE TABLE homework (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL,
|
||||
class_id UUID NOT NULL REFERENCES school_classes(id),
|
||||
subject_id UUID NOT NULL REFERENCES subjects(id),
|
||||
teacher_id UUID NOT NULL REFERENCES users(id),
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
due_date DATE NOT NULL,
|
||||
status VARCHAR(20) DEFAULT 'published' NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
)
|
||||
SQL);
|
||||
|
||||
$this->addSql('CREATE INDEX idx_homework_tenant ON homework(tenant_id)');
|
||||
$this->addSql('CREATE INDEX idx_homework_class ON homework(class_id)');
|
||||
$this->addSql('CREATE INDEX idx_homework_due_date ON homework(due_date)');
|
||||
$this->addSql('CREATE INDEX idx_homework_teacher ON homework(teacher_id)');
|
||||
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE TABLE homework_attachments (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
homework_id UUID NOT NULL REFERENCES homework(id) ON DELETE CASCADE,
|
||||
filename VARCHAR(255) NOT NULL,
|
||||
file_path VARCHAR(500) NOT NULL,
|
||||
file_size INT NOT NULL,
|
||||
mime_type VARCHAR(100) NOT NULL,
|
||||
uploaded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
)
|
||||
SQL);
|
||||
|
||||
$this->addSql('CREATE INDEX idx_homework_attachments_homework ON homework_attachments(homework_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE IF EXISTS homework_attachments');
|
||||
$this->addSql('DROP TABLE IF EXISTS homework');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user