Files
construprogress/app/Console/Commands/NotifyOverdueIssueTasks.php
T
javier 8c774d075d feat(issues): notificaciones, plantillas de checklist, alertas de vencimiento y reporte desde el mapa
- Notificaciones (DB): asignación de incidencia (IssueAssigned), asignación de tarea
  (IssueTaskAssigned), comentario (IssueCommented) y cambio de estado
  (IssueStatusChanged) a reporter+asignado excluyendo al actor.
- Plantillas de checklist: tabla issue_checklist_templates + modelo, gestor CRUD
  (IssueChecklistManager, ruta projects.issues.checklists) y "Aplicar plantilla" en
  el detalle (alta masiva de tareas).
- Alertas de vencimiento: columna overdue_notified_at + scope overdue, comando
  issues:notify-overdue (programado a diario) que avisa al asignado una sola vez;
  badge "vencidas" en la tabla y resaltado por tarea en el detalle.
- Reporte desde el mapa: botón "Incidencia" en el panel del feature seleccionado →
  formulario con feature pre-vinculado (IssueForm lee ?feature=).

Tests: IssuesEnhancementsTest (7). Suite 57 passing (solo 2 pre-existentes sqlite).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 12:51:41 +02:00

37 lines
987 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\IssueTask;
use App\Notifications\IssueTaskOverdueNotification;
use Illuminate\Console\Command;
class NotifyOverdueIssueTasks extends Command
{
protected $signature = 'issues:notify-overdue';
protected $description = 'Notify assignees of issue tasks that are overdue (one notification per task)';
public function handle(): int
{
$tasks = IssueTask::overdue()
->whereNull('overdue_notified_at')
->whereNotNull('assigned_to')
->with(['assignee', 'issue'])
->get();
$sent = 0;
foreach ($tasks as $task) {
if ($task->assignee) {
$task->assignee->notify(new IssueTaskOverdueNotification($task));
$sent++;
}
$task->forceFill(['overdue_notified_at' => now()])->save();
}
$this->info("Tareas vencidas notificadas: {$sent}");
return self::SUCCESS;
}
}