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.
26 lines
670 B
PHP
26 lines
670 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\SuperAdmin\Application\Command\ProvisionEstablishment;
|
|
|
|
/**
|
|
* Triggers async provisioning of a newly created establishment.
|
|
*
|
|
* Property names intentionally avoid "tenantId" to prevent the
|
|
* TenantDatabaseMiddleware from trying to switch to a database
|
|
* that doesn't exist yet.
|
|
*/
|
|
final readonly class ProvisionEstablishmentCommand
|
|
{
|
|
public function __construct(
|
|
public string $establishmentId,
|
|
public string $establishmentTenantId,
|
|
public string $databaseName,
|
|
public string $subdomain,
|
|
public string $adminEmail,
|
|
public string $establishmentName,
|
|
) {
|
|
}
|
|
}
|