Add ticket create notification event support
linter / quality (pull_request) Successful in 1m25s
tests / ci (8.4) (pull_request) Successful in 1m42s

This commit is contained in:
2026-04-24 19:35:13 +00:00
parent 083328f9de
commit 5f74ddd964
12 changed files with 262 additions and 18 deletions
@@ -2,17 +2,21 @@
namespace App\Actions\Tickets;
use App\Actions\Notifications\BuildTicketCreatedPayload;
use App\Actions\Notifications\TicketCreated;
use App\Enums\TicketWorklogEntryType;
use App\Models\Project;
use App\Models\Ticket;
use App\Models\TicketStatus;
use App\Models\User;
use Carbon\CarbonImmutable;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
class CreateProjectTicket
{
public function __construct(
private readonly BuildTicketCreatedPayload $buildTicketCreatedPayload,
private readonly CreateTicketWorklogEntry $createTicketWorklogEntry,
) {}
@@ -53,6 +57,8 @@ class CreateProjectTicket
'story_points' => Arr::get($attributes, 'story_points'),
]);
$occurredAt = CarbonImmutable::now();
if ($actor !== null) {
$this->createTicketWorklogEntry->handle(
$ticket,
@@ -69,6 +75,16 @@ class CreateProjectTicket
);
}
TicketCreated::dispatch(
$this->buildTicketCreatedPayload->handle(
$project,
$ticket,
$ticketStatus,
$actor,
$occurredAt,
),
);
return $ticket;
});
}