Merge pull request 'Add notification action foundation' (#47) from codex/v0.5-webhook-notification/01-notification-action-foundation into epic/notifications-and-webhooks
linter / quality (pull_request) Successful in 1m35s
tests / ci (8.4) (pull_request) Successful in 1m34s

Reviewed-on: OpenSource/KanbanGit#47
Reviewed-by: Koda <koda@twyco.de>
This commit was merged in pull request #47.
This commit is contained in:
2026-04-24 16:38:22 +00:00
22 changed files with 1047 additions and 0 deletions
@@ -0,0 +1,34 @@
<?php
namespace App\Http\Resources;
use App\Models\NotificationAction;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class NotificationActionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'project_id' => $this->project_id,
'name' => $this->name,
'enabled' => $this->enabled,
'event_type' => $this->event_type->value,
'event_type_label' => $this->event_type->label(),
'channel' => $this->channel->value,
'channel_label' => $this->channel->label(),
'channel_configuration' => $this->channel_configuration ?? [],
'has_delivery_url' => $this->resource instanceof NotificationAction && filled($this->delivery_url),
'message_template' => $this->message_template,
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
];
}
}
@@ -0,0 +1,37 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class NotificationDeliveryLogResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'notification_action_id' => $this->notification_action_id,
'event_type' => $this->event_type->value,
'event_type_label' => $this->event_type->label(),
'channel' => $this->channel->value,
'channel_label' => $this->channel->label(),
'delivery_status' => $this->delivery_status->value,
'delivery_status_label' => $this->delivery_status->label(),
'attempt_count' => $this->attempt_count,
'http_status' => $this->http_status,
'response_excerpt' => $this->response_excerpt,
'error_excerpt' => $this->error_excerpt,
'payload_metadata' => $this->payload_metadata,
'last_attempted_at' => $this->last_attempted_at?->toISOString(),
'delivered_at' => $this->delivered_at?->toISOString(),
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),
];
}
}