feat: implement integration management with CRUD operations and routes for tenant integration

This commit is contained in:
2026-07-03 14:44:18 -03:00
parent 0d4c6a4492
commit 3887a4fcba
16 changed files with 446 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?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('integrations', function (Blueprint $table) {
$table->id();
$table->string('integration_code')->unique();
$table->string('name');
$table->json('integration_data_schema')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('integrations');
}
};

View File

@@ -0,0 +1,36 @@
<?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('tenant_integration', function (Blueprint $table) {
$table->id();
$table->string('integration_code');
$table->string('tenant_code');
$table->longText('integration_data')->nullable(); // Stored as longText because it's encrypted JSON
$table->timestamps();
// Foreign keys
$table->foreign('integration_code')->references('integration_code')->on('integrations')->onDelete('cascade');
$table->foreign('tenant_code')->references('codigo')->on('tenants')->onDelete('cascade');
$table->unique(['integration_code', 'tenant_code']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tenant_integration');
}
};

View File

@@ -0,0 +1,26 @@
<?php
namespace Database\Seeders;
use App\Domains\Integration\Models\Integration;
use Illuminate\Database\Seeder;
class TelepagosIntegrationSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Integration::updateOrCreate(
['integration_code' => 'telepagos'],
[
'name' => 'Telepagos',
'integration_data_schema' => [
'username' => 'required|string',
'password' => 'required|string',
]
]
);
}
}