TenantAtlas/apps/platform/routes/console.php
ahmido e64bae9cfc feat: cut over tenant core to managed environments (#335)
## Summary
- replace the legacy Tenant and TenantMembership core models with ManagedEnvironment and ManagedEnvironmentMembership
- propagate the managed environment naming and key changes across Filament resources, pages, controllers, jobs, models, and supporting runtime paths
- add feature 279 spec artifacts and focused managed-environment test coverage for model behavior, route binding, panel context, authorization, and legacy guardrails

## Validation
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/ManagedEnvironment/LegacyTenantCoreGuardTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentAuthorizationTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentPanelContextTest.php tests/Feature/ManagedEnvironment/ManagedEnvironmentRouteBindingTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentContextResolverTest.php tests/Unit/ManagedEnvironment/ManagedEnvironmentModelTest.php`
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`

## Notes
- branch pushed from commit `1123b122`
- browser smoke test file was added but not run in this pass

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #335
2026-05-07 06:38:14 +00:00

78 lines
2.3 KiB
PHP

<?php
use App\Jobs\PruneOldOperationRunsJob;
use App\Jobs\ReconcileAdapterRunsJob;
use App\Jobs\ScanEntraAdminRolesJob;
use App\Models\ManagedEnvironment;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
Schedule::command('tenantpilot:schedules:dispatch')->everyMinute();
Schedule::command('tenantpilot:directory-groups:dispatch')->everyMinute();
Schedule::command('tenantpilot:alerts:dispatch')
->everyMinute()
->name('tenantpilot:alerts:dispatch')
->withoutOverlapping();
Schedule::job(new PruneOldOperationRunsJob)
->daily()
->name(PruneOldOperationRunsJob::class)
->withoutOverlapping();
Schedule::job(new ReconcileAdapterRunsJob)
->everyThirtyMinutes()
->name(ReconcileAdapterRunsJob::class)
->withoutOverlapping();
Schedule::command('tenantpilot:operation-runs:reconcile')
->everyFiveMinutes()
->name('tenantpilot:operation-runs:reconcile')
->withoutOverlapping();
Schedule::command('stored-reports:prune')
->daily()
->name('stored-reports:prune')
->withoutOverlapping();
Schedule::command('tenantpilot:product-usage:prune')
->daily()
->name('tenantpilot:product-usage:prune')
->withoutOverlapping();
Schedule::command('tenantpilot:review-pack:prune')
->daily()
->name('tenantpilot:review-pack:prune')
->withoutOverlapping();
Schedule::command('tenantpilot:baseline-evidence:prune')
->daily()
->name('tenantpilot:baseline-evidence:prune')
->withoutOverlapping();
Schedule::call(function (): void {
$tenants = ManagedEnvironment::query()
->whereHas('providerConnections', function ($q): void {
$q->where('status', 'connected');
})
->whereNotNull('workspace_id')
->get();
foreach ($tenants as $tenant) {
ScanEntraAdminRolesJob::dispatch(
tenantId: (int) $tenant->getKey(),
workspaceId: (int) $tenant->workspace_id,
);
}
})
->daily()
->name('entra-admin-roles:scan')
->withoutOverlapping();
// TODO: Add tenantpilot:posture:dispatch schedule entry once the command
// infrastructure exists (FR-015 deferred — see specs/109 research.md §7).