From 578b2fb5550c26d8af31362a326f708b8eeb403a Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:30:19 -0400 Subject: [PATCH 01/17] migration for history integration table --- ...32722_create_integration_history_table.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php diff --git a/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php new file mode 100644 index 000000000..389b51e15 --- /dev/null +++ b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php @@ -0,0 +1,46 @@ +id(); + $table->unsignedBigInteger('apps_id')->default(0); + $table->string('entity_namespace'); + $table->unsignedBigInteger('entity_id'); + $table->unsignedBigInteger('integrations_company_id'); + $table->unsignedBigInteger('status_id'); + $table->text('response')->nullable(); + $table->text('exception')->nullable(); + $table->timestamps(); + $table->tinyInteger('is_deleted')->default(0); + + // Foreign key constraints + $table->foreign('integrations_company_id')->references('id')->on('integration_companies'); + $table->foreign('status_id')->references('id')->on('status'); + + $table->index('status_id', 'status_id_index'); + $table->index('integrations_company_id', 'integrations_company_id_index'); + $table->index('apps_id', 'apps_id_index'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('entity_integration_history'); + } +}; From eaa9a62747db2b8790495327fc527a22e1b1e35e Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:30:41 -0400 Subject: [PATCH 02/17] Create entity integration model --- .../Models/EntityIntegrationHistory.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php diff --git a/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php b/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php new file mode 100644 index 000000000..d0cfebb29 --- /dev/null +++ b/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php @@ -0,0 +1,48 @@ + 'boolean', + ]; + + public function integrationCompany(): BelongsTo + { + return $this->belongsTo(IntegrationsCompany::class, 'integrations_company_id'); + } + + public function entity(): BelongsTo + { + return $this->belongsTo($this->entity_class_name, 'entity_id'); + } + + public function status(): BelongsTo + { + return $this->belongsTo(Status::class, 'status_id'); + } + + public function setStatus(Status $status): void + { + $this->status_id = $status->getId(); + $this->saveOrFail(); + } +} From 8508e6dab8e11d11c55197c434eaac38cec63e40 Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:31:17 -0400 Subject: [PATCH 03/17] Create entity integration interface --- .../Workflow/Contracts/EntityIntegrationInterface.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/Domains/Workflow/Contracts/EntityIntegrationInterface.php diff --git a/src/Domains/Workflow/Contracts/EntityIntegrationInterface.php b/src/Domains/Workflow/Contracts/EntityIntegrationInterface.php new file mode 100644 index 000000000..00a51b805 --- /dev/null +++ b/src/Domains/Workflow/Contracts/EntityIntegrationInterface.php @@ -0,0 +1,10 @@ + Date: Mon, 16 Sep 2024 20:31:31 -0400 Subject: [PATCH 04/17] Implement interface for integration --- src/Domains/Inventory/Products/Models/Products.php | 4 +++- src/Domains/Inventory/Variants/Models/Variants.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Domains/Inventory/Products/Models/Products.php b/src/Domains/Inventory/Products/Models/Products.php index 3c0d333b1..63c1eafc0 100644 --- a/src/Domains/Inventory/Products/Models/Products.php +++ b/src/Domains/Inventory/Products/Models/Products.php @@ -30,6 +30,8 @@ use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Social\Interactions\Traits\LikableTrait; use Kanvas\Social\Tags\Traits\HasTagsTrait; +use Kanvas\Workflow\Contracts\EntityIntegrationInterface; +use Kanvas\Workflow\Contracts\IntegrationInterface; use Kanvas\Workflow\Traits\CanUseWorkflow; use Laravel\Scout\Searchable; @@ -52,7 +54,7 @@ * @property string $published_at * @property bool $is_deleted */ -class Products extends BaseModel +class Products extends BaseModel implements EntityIntegrationInterface { use UuidTrait; use SlugTrait; diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index 0539d6738..4d3838367 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -29,6 +29,7 @@ use Kanvas\Inventory\Variants\Actions\AddAttributeAction; use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Social\Interactions\Traits\SocialInteractionsTrait; +use Kanvas\Workflow\Contracts\EntityIntegrationInterface; use Laravel\Scout\Searchable; /** @@ -49,7 +50,7 @@ * @property string barcode * @property string serial_number */ -class Variants extends BaseModel +class Variants extends BaseModel implements EntityIntegrationInterface { use SlugTrait; use UuidTrait; From bc082dcca03434f409e9b7b624cfc6bfac6d161c Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:31:50 -0400 Subject: [PATCH 05/17] Create entity integration history --- .../EntityIntegrationHistory.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Domains/Workflow/Integrations/DataTransferObject/EntityIntegrationHistory.php diff --git a/src/Domains/Workflow/Integrations/DataTransferObject/EntityIntegrationHistory.php b/src/Domains/Workflow/Integrations/DataTransferObject/EntityIntegrationHistory.php new file mode 100644 index 000000000..a620583d6 --- /dev/null +++ b/src/Domains/Workflow/Integrations/DataTransferObject/EntityIntegrationHistory.php @@ -0,0 +1,29 @@ + Date: Mon, 16 Sep 2024 20:33:41 -0400 Subject: [PATCH 06/17] Create integration action history --- .../AddEntityIntegrationHistoryAction.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php diff --git a/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php b/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php new file mode 100644 index 000000000..675617869 --- /dev/null +++ b/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php @@ -0,0 +1,44 @@ +entity_namespace = get_class($this->dto->entity); + $integrationHistory->entity_id = $this->dto->entity->getId(); + $integrationHistory->integrations_company_id = $this->dto->integrationCompany->getId(); + $integrationHistory->status_id = $this->dto->status->getId(); + $integrationHistory->response = $this->dto->response; + $integrationHistory->exception = $this->dto->exception; + + $integrationHistory->saveOrFail(); + return $integrationHistory; + } +} From 2f1204cfbde1cd143433a4138586bc34857bc672 Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:36:16 -0400 Subject: [PATCH 07/17] Create export product activity --- .../ExportProductToShopifyActivity.php | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php b/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php index 3f3bd4e68..a86841adb 100644 --- a/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php +++ b/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php @@ -10,8 +10,11 @@ use Kanvas\Inventory\Products\Models\Products; use Kanvas\Workflow\Enums\IntegrationsEnum; use Kanvas\Workflow\Enums\StatusEnum; +use Kanvas\Workflow\Integrations\Actions\AddEntityIntegrationHistoryAction; +use Kanvas\Workflow\Integrations\DataTransferObject\EntityIntegrationHistory; use Kanvas\Workflow\Integrations\Models\IntegrationsCompany; use Kanvas\Workflow\Integrations\Models\Status; +use Throwable; use Workflow\Activity; class ExportProductToShopifyActivity extends Activity @@ -21,6 +24,7 @@ class ExportProductToShopifyActivity extends Activity public function execute(Products $product, Apps $app, array $params): array { $response = []; + $exception = null; $status = Status::where('slug', StatusEnum::ACTIVE->value) ->where('apps_id', 0) ->first(); @@ -43,7 +47,33 @@ public function execute(Products $product, Apps $app, array $params): array warehouses: $warehouse ); - $response = $shopifyService->saveProduct($product, ShopifyStatusEnum::ACTIVE); + try { + $response = $shopifyService->saveProduct($product, ShopifyStatusEnum::ACTIVE); + $historyResponse = json_encode($response); + $status = Status::where('slug', StatusEnum::CONNECTED->value) + ->where('apps_id', 0) + ->first(); + + } catch (Throwable $exception) { + $status = Status::where('slug', StatusEnum::FAILED->value) + ->where('apps_id', 0) + ->first(); + } + + $dto = new EntityIntegrationHistory( + app: $app, + integrationCompany: $integrationCompany, + status: $status, + entity: $product, + response: $historyResponse ?? null, + exception: $exception + ); + + (new AddEntityIntegrationHistoryAction( + dto: $dto, + app: $app, + status: $status + ))->execute(); } } } @@ -51,7 +81,7 @@ public function execute(Products $product, Apps $app, array $params): array return [ 'company' => $product->company->getId(), 'product' => $product->getId(), - 'shopify_response' => $response, + 'shopify_response' => $response ?? [], ]; } } From 93c1060ea3acf6011dbfc68cec5fd408e9359639 Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:51:26 -0400 Subject: [PATCH 08/17] stylo --- .../2024_09_15_232722_create_integration_history_table.php | 2 +- .../Workflows/Activities/ExportProductToShopifyActivity.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php index 389b51e15..9606d6859 100644 --- a/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php +++ b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Schema; return new class () extends Migration { -/** + /** * Run the migrations. * * @return void diff --git a/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php b/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php index a86841adb..c0c22fbee 100644 --- a/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php +++ b/src/Domains/Connectors/Shopify/Workflows/Activities/ExportProductToShopifyActivity.php @@ -53,7 +53,6 @@ public function execute(Products $product, Apps $app, array $params): array $status = Status::where('slug', StatusEnum::CONNECTED->value) ->where('apps_id', 0) ->first(); - } catch (Throwable $exception) { $status = Status::where('slug', StatusEnum::FAILED->value) ->where('apps_id', 0) From 964a6bde039ef9d3e0b794f89755b57b198fae3c Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 16 Sep 2024 20:52:20 -0400 Subject: [PATCH 09/17] id index add migration --- .../2024_09_15_232722_create_integration_history_table.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php index 9606d6859..4a1ec81d2 100644 --- a/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php +++ b/database/migrations/Workflow/2024_09_15_232722_create_integration_history_table.php @@ -28,6 +28,7 @@ public function up() $table->foreign('integrations_company_id')->references('id')->on('integration_companies'); $table->foreign('status_id')->references('id')->on('status'); + $table->index('entity_id', 'entity_id_index'); $table->index('status_id', 'status_id_index'); $table->index('integrations_company_id', 'integrations_company_id_index'); $table->index('apps_id', 'apps_id_index'); From f438717bd0efa16ff85310aebfa0239c97f8bc73 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:43:50 -0400 Subject: [PATCH 10/17] return the integration created --- tests/Connectors/Traits/HasShopifyConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Connectors/Traits/HasShopifyConfiguration.php b/tests/Connectors/Traits/HasShopifyConfiguration.php index 830d9759b..e1b343d94 100644 --- a/tests/Connectors/Traits/HasShopifyConfiguration.php +++ b/tests/Connectors/Traits/HasShopifyConfiguration.php @@ -59,6 +59,6 @@ public function setupShopifyIntegration(Products $product, Regions $region) // for the time being this can only work with shopify integration. // we need to figure out how to standard is it. - (new CreateIntegrationCompanyAction($integrationDto, auth()->user(), $status))->execute(); + return (new CreateIntegrationCompanyAction($integrationDto, auth()->user(), $status))->execute(); } } From 16a0014a36db8b231817a3a59cf68e47243e5397 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:44:08 -0400 Subject: [PATCH 11/17] Add relation to history of integrations --- .../Workflow/Integrations/Models/IntegrationsCompany.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Domains/Workflow/Integrations/Models/IntegrationsCompany.php b/src/Domains/Workflow/Integrations/Models/IntegrationsCompany.php index d3b8160d3..4ea9080eb 100644 --- a/src/Domains/Workflow/Integrations/Models/IntegrationsCompany.php +++ b/src/Domains/Workflow/Integrations/Models/IntegrationsCompany.php @@ -6,6 +6,7 @@ use Baka\Casts\Json; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Regions\Models\Regions; use Kanvas\Workflow\Enums\StatusEnum; @@ -43,6 +44,11 @@ public function status(): BelongsTo return $this->belongsTo(Status::class, 'status_id'); } + public function history(): HasMany + { + return $this->hasMany(EntityIntegrationHistory::class, 'integrations_company_id'); + } + public function setStatus(Status $status): void { $this->status_id = $status->getId(); From 83e0396d78c7b43ecda4cb60bc23f8081f54a302 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:44:41 -0400 Subject: [PATCH 12/17] Create integration history service to manage methods --- .../EntityIntegrationHistoryService.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php diff --git a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php new file mode 100644 index 000000000..23f4d4a1c --- /dev/null +++ b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php @@ -0,0 +1,54 @@ +getId()) + ->where('companies_id', $this->company->getId()) + ->when($region, function ($query, $region) { + return $query->where('region_id', $region->getId()); + }) + ->get(); + + foreach($integrationsCompany as $integrationCompany) + { + if ($integrationCompany->history()->where('apps_id', $this->app->getId())->exists()){ + $integrationStatus = array_merge( + $integrationStatus, + $integrationCompany->history->map(function ($history) { + return $history; + })->all() + ); + }; + } + return $integrationStatus; + } + +} \ No newline at end of file From 66e8e67809092c250bfa49f67895d7dbef694272 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:45:39 -0400 Subject: [PATCH 13/17] Add test to validate integration history creation --- .../ExportProductToShopifyActivityTest.php | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/Connectors/Integration/Shopify/ExportProductToShopifyActivityTest.php b/tests/Connectors/Integration/Shopify/ExportProductToShopifyActivityTest.php index 3a5a21803..7bfaca7e5 100644 --- a/tests/Connectors/Integration/Shopify/ExportProductToShopifyActivityTest.php +++ b/tests/Connectors/Integration/Shopify/ExportProductToShopifyActivityTest.php @@ -7,6 +7,9 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Connectors\Shopify\Workflows\Activities\ExportProductToShopifyActivity; use Kanvas\Inventory\Products\Models\Products; +use Kanvas\Workflow\Integrations\Models\EntityIntegrationHistory; +use Kanvas\Workflow\Integrations\Services\EntityIntegrationHistoryService; +use Kanvas\Workflow\Models\Integrations; use Kanvas\Workflow\Models\StoredWorkflow; use Tests\Connectors\Traits\HasShopifyConfiguration; use Tests\TestCase; @@ -38,9 +41,48 @@ public function testExportProductWorkflow(): void params: [] ); - //We need to DELETE the exported product after the test. + //@todo We need to DELETE the exported product after the test. $this->assertArrayHasKey('shopify_response', $result); $this->assertArrayHasKey('company', $result); $this->assertArrayHasKey('product', $result); } + + public function testIntegrationHistory(): void + { + $integration = Integrations::first(); + $product = Products::first(); + + $variant = $product->variants()->first(); + $warehouse = $variant->warehouses()->first(); + + $this->setupShopifyIntegration($product, $warehouse->region); + + $exportActivity = new ExportProductToShopifyActivity( + 0, + now()->toDateTimeString(), + StoredWorkflow::make(), + [] + ); + + $app = app(Apps::class); + + $result = $exportActivity->execute( + product: $product, + app: $app, + params: [] + ); + + //@todo We need to DELETE the exported product after the test. + $this->assertArrayHasKey('shopify_response', $result); + $this->assertArrayHasKey('company', $result); + $this->assertArrayHasKey('product', $result); + + $histories = (new EntityIntegrationHistoryService( + app: $app, + company: $product->company + ))->getByIntegration($integration); + + $this->assertNotEmpty($histories); + $this->assertInstanceOf(EntityIntegrationHistory::class, $histories[0]); + } } From bcf240392475d6645204b02cf594d8f5335b1e28 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:48:34 -0400 Subject: [PATCH 14/17] stylo --- .../Services/EntityIntegrationHistoryService.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php index 23f4d4a1c..53cecedb5 100644 --- a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php +++ b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php @@ -10,7 +10,6 @@ use Kanvas\Workflow\Integrations\Models\IntegrationsCompany; use Kanvas\Workflow\Models\Integrations; - class EntityIntegrationHistoryService { public function __construct( @@ -37,11 +36,10 @@ public function getByIntegration(Integrations $integration, ?Regions $region = n }) ->get(); - foreach($integrationsCompany as $integrationCompany) - { + foreach($integrationsCompany as $integrationCompany) { if ($integrationCompany->history()->where('apps_id', $this->app->getId())->exists()){ $integrationStatus = array_merge( - $integrationStatus, + $integrationStatus, $integrationCompany->history->map(function ($history) { return $history; })->all() From 59110d1f8d989f2b3ecf7d0db480d157365aa4a3 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:51:06 -0400 Subject: [PATCH 15/17] stylo 2 --- .../Services/EntityIntegrationHistoryService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php index 53cecedb5..ab5f4273e 100644 --- a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php +++ b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php @@ -36,8 +36,8 @@ public function getByIntegration(Integrations $integration, ?Regions $region = n }) ->get(); - foreach($integrationsCompany as $integrationCompany) { - if ($integrationCompany->history()->where('apps_id', $this->app->getId())->exists()){ + foreach ($integrationsCompany as $integrationCompany) { + if ($integrationCompany->history()->where('apps_id', $this->app->getId())->exists()) { $integrationStatus = array_merge( $integrationStatus, $integrationCompany->history->map(function ($history) { @@ -48,5 +48,4 @@ public function getByIntegration(Integrations $integration, ?Regions $region = n } return $integrationStatus; } - } \ No newline at end of file From e71f142cdab2b6169d6dee2c225783fd3c7b8003 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 15:52:05 -0400 Subject: [PATCH 16/17] stylo 3 --- .../Integrations/Services/EntityIntegrationHistoryService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php index ab5f4273e..e05d80090 100644 --- a/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php +++ b/src/Domains/Workflow/Integrations/Services/EntityIntegrationHistoryService.php @@ -48,4 +48,4 @@ public function getByIntegration(Integrations $integration, ?Regions $region = n } return $integrationStatus; } -} \ No newline at end of file +} From e8ab3ea84233795aa8ccfe854ff1b23ddc45a5d5 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 17 Sep 2024 16:08:03 -0400 Subject: [PATCH 17/17] Add apps id to integration history --- .../Integrations/Actions/AddEntityIntegrationHistoryAction.php | 1 + .../Workflow/Integrations/Models/EntityIntegrationHistory.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php b/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php index 675617869..ee66a69c9 100644 --- a/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php +++ b/src/Domains/Workflow/Integrations/Actions/AddEntityIntegrationHistoryAction.php @@ -33,6 +33,7 @@ public function execute(): ModelsEntityIntegrationHistory $integrationHistory = new ModelsEntityIntegrationHistory(); $integrationHistory->entity_namespace = get_class($this->dto->entity); $integrationHistory->entity_id = $this->dto->entity->getId(); + $integrationHistory->apps_id = $this->app->getId(); $integrationHistory->integrations_company_id = $this->dto->integrationCompany->getId(); $integrationHistory->status_id = $this->dto->status->getId(); $integrationHistory->response = $this->dto->response; diff --git a/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php b/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php index d0cfebb29..f44d645d7 100644 --- a/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php +++ b/src/Domains/Workflow/Integrations/Models/EntityIntegrationHistory.php @@ -14,6 +14,7 @@ class EntityIntegrationHistory extends BaseModel protected $fillable = [ 'entity_namespace', + 'apps_id', 'entity_id', 'integrations_company_id', 'status_id',