Add integrations health monitoring
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-02 18:35:12 +01:00
parent 9057a4cd15
commit fc3e6715db
21 changed files with 715 additions and 13 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Database\Factories;
use App\Models\IntegrationWebhookEvent;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\IntegrationWebhookEvent>
*/
class IntegrationWebhookEventFactory extends Factory
{
protected $model = IntegrationWebhookEvent::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$receivedAt = $this->faker->dateTimeBetween('-2 days', 'now');
$processedAt = (clone $receivedAt)->modify('+2 minutes');
return [
'provider' => $this->faker->randomElement(['paddle', 'revenuecat']),
'event_id' => $this->faker->uuid(),
'event_type' => $this->faker->word(),
'status' => IntegrationWebhookEvent::STATUS_PROCESSED,
'received_at' => $receivedAt,
'processed_at' => $processedAt,
'failed_at' => null,
'error_message' => null,
'context' => [],
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('integration_webhook_events', function (Blueprint $table) {
$table->id();
$table->string('provider', 40);
$table->string('event_id', 191)->nullable();
$table->string('event_type', 120)->nullable();
$table->string('status', 30)->default('received');
$table->timestamp('received_at');
$table->timestamp('processed_at')->nullable();
$table->timestamp('failed_at')->nullable();
$table->string('error_message', 500)->nullable();
$table->json('context')->nullable();
$table->timestamps();
$table->index(['provider', 'status']);
$table->index(['provider', 'received_at']);
$table->index(['provider', 'event_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('integration_webhook_events');
}
};

View File

@@ -0,0 +1,16 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class IntegrationWebhookEventSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}