feat: implement integration management with CRUD operations and routes for tenant integration
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
}
|
||||
};
|
||||
26
database/seeders/TelepagosIntegrationSeeder.php
Normal file
26
database/seeders/TelepagosIntegrationSeeder.php
Normal 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',
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user