From e4fee7252962bf8cead0235c77e242db3a396c0c Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:12:26 -0400 Subject: [PATCH 01/54] Allow user to assign multiples warehouses --- graphql/schemas/Inventory/variant.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index c6168df67..bbc8445aa 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -69,7 +69,7 @@ input VariantsInput { price: Float source_id: Mixed attributes: [VariantsAttributesInput!] - warehouse: WarehouseReferenceInput + warehouses: [WarehouseReferenceInput!] channels: [VariantChannelReferenceInput!] custom_fields: [CustomFieldEntityInput!] } From 836df21acf4fdb99c2f6cd61bdbe617617942a2c Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:15:18 -0400 Subject: [PATCH 02/54] Move add warehouses logic to service --- .../Inventory/Mutations/Variants/Variants.php | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 046ba0814..73f5a9926 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -7,7 +7,6 @@ use Kanvas\Inventory\Attributes\Repositories\AttributesRepository; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Channels\Repositories\ChannelRepository; -use Kanvas\Inventory\Status\Models\Status; use Kanvas\Inventory\Status\Repositories\StatusRepository; use Kanvas\Inventory\Variants\Actions\AddAttributeAction; use Kanvas\Inventory\Variants\Actions\AddToWarehouseAction as AddToWarehouse; @@ -46,29 +45,34 @@ public function create(mixed $root, array $req): VariantModel if (isset($req['input']['attributes'])) { $variantModel->addAttributes(auth()->user(), $req['input']['attributes']); } - if (! $variantDto->warehouse_id) { - $variantDto->warehouse_id = Warehouses::getDefault($company)->getId(); - } - $warehouse = WarehouseRepository::getById($variantDto->warehouse_id, $company); - if (isset($req['input']['warehouse']['status'])) { - $status = StatusRepository::getById( - (int) $req['input']['warehouse']['status']['id'], - $company - )->getId(); + if(isset($req['input']['warehouses'])) { + foreach($req['input']['warehouses'] as $warehouseData) { + $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); + + VariantService::addToWarehouses( + $variantModel, + $warehouse, + $company, + $warehouseData + ); + } } else { - $status = Status::getDefault($company); + $warehouse = Warehouses::getDefault($company); + + VariantService::addToWarehouses( + $variantModel, + $warehouse, + $company, + [] + ); } - $req['input']['warehouse']['status_id'] = $status ? $status->getId() : null; if (! empty($variantDto->files)) { foreach ($variantDto->files as $file) { $variantModel->addFileFromUrl($file['url'], $file['name']); } } - $variantWarehouses = VariantsWarehouses::viaRequest($req['input']['warehouse'] ?? []); - - (new AddToWarehouse($variantModel, $warehouse, $variantWarehouses))->execute(); if (isset($req['input']['channels'])) { foreach ($req['input']['channels'] as $variantChannel) { From 097e95d362545db05a998167622b6ad9a2a9f3c1 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:15:37 -0400 Subject: [PATCH 03/54] remove warehouses from dto variant --- src/Domains/Inventory/Variants/DataTransferObject/Variants.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Domains/Inventory/Variants/DataTransferObject/Variants.php b/src/Domains/Inventory/Variants/DataTransferObject/Variants.php index 1ac2edf88..55a500935 100644 --- a/src/Domains/Inventory/Variants/DataTransferObject/Variants.php +++ b/src/Domains/Inventory/Variants/DataTransferObject/Variants.php @@ -15,7 +15,6 @@ public function __construct( public Products $product, public string $name, public string $sku, - public ?int $warehouse_id = null, public ?string $description = null, public ?int $status_id = null, public ?string $short_description = null, @@ -40,7 +39,6 @@ public static function viaRequest(array $request, UserInterface $user): self $product, $request['name'], $request['sku'], - isset($request['warehouse']['id']) ? (int) $request['warehouse']['id'] : null, $request['description'] ?? null, $request['status_id'] ?? null, $request['short_description'] ?? null, From 5b0ef8d8c1b6aa6b3486e2378d01e6a25dd1e487 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:16:15 -0400 Subject: [PATCH 04/54] Add method to add to warehouses --- .../Variants/Services/VariantService.php | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 2422d9f85..26be6c8f1 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -5,6 +5,7 @@ namespace Kanvas\Inventory\Variants\Services; use Baka\Users\Contracts\UserInterface; +use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Products\DataTransferObject\Product as ProductDto; use Kanvas\Inventory\Products\Models\Products; @@ -111,11 +112,7 @@ public static function createDefaultVariant(Products $product, UserInterface $us $company = $variantDto->product->company()->get()->first(); - if (! $variantDto->warehouse_id) { - $variantDto->warehouse_id = Warehouses::getDefault($company)->getId(); - } - - $warehouse = WarehouseRepository::getById($variantDto->warehouse_id, $company); + $warehouse = Warehouses::getDefault($company); if (isset($variant['warehouse']['status'])) { $variant['warehouse']['status_id'] = StatusRepository::getById( @@ -190,4 +187,26 @@ public static function addVariantChannel( $variantChannelDto ))->execute(); } + + public static function addToWarehouses( + Variants $variant, + Warehouses $warehouse, + Companies $company, + array $warehousesInfo + ): ModelsVariantsWarehouses { + + if (isset($warehousesInfo['status'])) { + $status = StatusRepository::getById( + (int) $warehousesInfo['status']['id'], + $company + )->getId(); + } else { + $status = Status::getDefault($company); + } + + $warehousesInfo['status_id'] = $status ? $status->getId() : null; + $variantWarehouses = VariantsWarehouses::viaRequest($warehousesInfo ?? []); + + return (new AddToWarehouse($variant, $warehouse, $variantWarehouses))->execute(); + } } From a7fd260b119b8b5f9b4531d7dde26f2c08af52c8 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:16:24 -0400 Subject: [PATCH 05/54] Update tests --- tests/GraphQL/Inventory/ProductsTest.php | 4 ++-- tests/GraphQL/Inventory/RemoveVariantsToWarehouseTest.php | 2 +- tests/GraphQL/Inventory/VariantAttributeTest.php | 4 ++-- tests/GraphQL/Inventory/VariantTest.php | 6 +++--- tests/GraphQL/Inventory/VariantsChannelsTest.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/GraphQL/Inventory/ProductsTest.php b/tests/GraphQL/Inventory/ProductsTest.php index c8a03ea0e..9d3aac68d 100644 --- a/tests/GraphQL/Inventory/ProductsTest.php +++ b/tests/GraphQL/Inventory/ProductsTest.php @@ -258,7 +258,7 @@ public function testAddVariantToProduct(): void 'description' => fake()->text, 'products_id' => $id, 'sku' => fake()->time, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $variantResponse = $this->graphQL(' mutation($data: VariantsInput!) { @@ -371,7 +371,7 @@ public function testDeleteVariantToProduct(): void 'description' => fake()->text, 'products_id' => $id, 'sku' => fake()->time, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $variantResponse = $this->graphQL(' mutation($data: VariantsInput!) { diff --git a/tests/GraphQL/Inventory/RemoveVariantsToWarehouseTest.php b/tests/GraphQL/Inventory/RemoveVariantsToWarehouseTest.php index 6a97b4123..041e7fa94 100644 --- a/tests/GraphQL/Inventory/RemoveVariantsToWarehouseTest.php +++ b/tests/GraphQL/Inventory/RemoveVariantsToWarehouseTest.php @@ -88,7 +88,7 @@ public function testRemoveVariantToWarehouse(): void 'description' => fake()->text, 'products_id' => $productId, 'sku' => fake()->time, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { diff --git a/tests/GraphQL/Inventory/VariantAttributeTest.php b/tests/GraphQL/Inventory/VariantAttributeTest.php index 3c6d8eddd..974ed9464 100644 --- a/tests/GraphQL/Inventory/VariantAttributeTest.php +++ b/tests/GraphQL/Inventory/VariantAttributeTest.php @@ -89,7 +89,7 @@ public function testAddAttributeToVariant(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $productId, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { @@ -218,7 +218,7 @@ public function testRemoveAttributeFromVariant(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $productId, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { diff --git a/tests/GraphQL/Inventory/VariantTest.php b/tests/GraphQL/Inventory/VariantTest.php index 2cb5d3708..0aaca6ce5 100644 --- a/tests/GraphQL/Inventory/VariantTest.php +++ b/tests/GraphQL/Inventory/VariantTest.php @@ -109,7 +109,7 @@ public function testUpdateVariant(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $id, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $variantResponse = $this->graphQL(' mutation($data: VariantsInput!) { @@ -226,7 +226,7 @@ public function testAddVariantToWarehouse(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $productId, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { @@ -379,7 +379,7 @@ public function testUpdateVariantToWarehouse(): void 'description' => fake()->text, 'products_id' => $productId, 'sku' => fake()->time, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { diff --git a/tests/GraphQL/Inventory/VariantsChannelsTest.php b/tests/GraphQL/Inventory/VariantsChannelsTest.php index 607699a7e..6ba3fa5cb 100644 --- a/tests/GraphQL/Inventory/VariantsChannelsTest.php +++ b/tests/GraphQL/Inventory/VariantsChannelsTest.php @@ -88,7 +88,7 @@ public function testVariantToChannel(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $productId, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { @@ -242,7 +242,7 @@ public function testUpdateVariantToChannel(): void 'description' => fake()->text, 'sku' => fake()->time, 'products_id' => $productId, - 'warehouse' => $warehouseData + 'warehouses' => [$warehouseData] ]; $response = $this->graphQL(' mutation($data: VariantsInput!) { From 259e01fca6a1b30d4521f2252028d5070784e270 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:21:06 -0400 Subject: [PATCH 06/54] stylo --- app/GraphQL/Inventory/Mutations/Variants/Variants.php | 2 +- src/Domains/Inventory/Variants/Services/VariantService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 73f5a9926..7d6cb261e 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -46,7 +46,7 @@ public function create(mixed $root, array $req): VariantModel $variantModel->addAttributes(auth()->user(), $req['input']['attributes']); } - if(isset($req['input']['warehouses'])) { + if (isset($req['input']['warehouses'])) { foreach($req['input']['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 26be6c8f1..c80090b66 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -189,7 +189,7 @@ public static function addVariantChannel( } public static function addToWarehouses( - Variants $variant, + Variants $variant, Warehouses $warehouse, Companies $company, array $warehousesInfo From 09d03eca96fe3a187c3fbe6d70a17980ca41f6ec Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:22:10 -0400 Subject: [PATCH 07/54] stylo2 --- app/GraphQL/Inventory/Mutations/Variants/Variants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 7d6cb261e..829ed84e6 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -47,7 +47,7 @@ public function create(mixed $root, array $req): VariantModel } if (isset($req['input']['warehouses'])) { - foreach($req['input']['warehouses'] as $warehouseData) { + foreach( $req['input']['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); VariantService::addToWarehouses( From cf3b580da37f026049d761cd90b1d41325a13e77 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:22:53 -0400 Subject: [PATCH 08/54] again --- app/GraphQL/Inventory/Mutations/Variants/Variants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 829ed84e6..16714e6e9 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -47,7 +47,7 @@ public function create(mixed $root, array $req): VariantModel } if (isset($req['input']['warehouses'])) { - foreach( $req['input']['warehouses'] as $warehouseData) { + foreach ($req['input']['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); VariantService::addToWarehouses( From 42c670ac85912d682d46c2b24ba80cabca8beaf8 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 16 May 2024 18:23:34 -0400 Subject: [PATCH 09/54] remove spaces --- src/Domains/Inventory/Variants/Services/VariantService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index c80090b66..3f1420c6b 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -194,7 +194,6 @@ public static function addToWarehouses( Companies $company, array $warehousesInfo ): ModelsVariantsWarehouses { - if (isset($warehousesInfo['status'])) { $status = StatusRepository::getById( (int) $warehousesInfo['status']['id'], From e550249b331cd9d5b39821d5a50c84d6776793fe Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 18 May 2024 17:53:24 -0400 Subject: [PATCH 10/54] fix: shopify sync --- .../ShopifyInventoryDownloadCommand.php | 2 +- .../Shopify/ShopifyInventorySyncCommand.php | 22 +++++++++---------- .../Services/ShopifyInventoryService.php | 21 ++++++++++-------- 3 files changed, 24 insertions(+), 21 deletions(-) rename app/Console/Commands/{ => Connectors}/Shopify/ShopifyInventoryDownloadCommand.php (96%) rename app/Console/Commands/{ => Connectors}/Shopify/ShopifyInventorySyncCommand.php (65%) diff --git a/app/Console/Commands/Shopify/ShopifyInventoryDownloadCommand.php b/app/Console/Commands/Connectors/Shopify/ShopifyInventoryDownloadCommand.php similarity index 96% rename from app/Console/Commands/Shopify/ShopifyInventoryDownloadCommand.php rename to app/Console/Commands/Connectors/Shopify/ShopifyInventoryDownloadCommand.php index 04bfab9f5..eb8656313 100644 --- a/app/Console/Commands/Shopify/ShopifyInventoryDownloadCommand.php +++ b/app/Console/Commands/Connectors/Shopify/ShopifyInventoryDownloadCommand.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Console\Commands\Shopify; +namespace App\Console\Commands\Connectors\Shopify; use Illuminate\Console\Command; use Kanvas\Apps\Models\Apps; diff --git a/app/Console/Commands/Shopify/ShopifyInventorySyncCommand.php b/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php similarity index 65% rename from app/Console/Commands/Shopify/ShopifyInventorySyncCommand.php rename to app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php index 88d101e4b..f0f463b1f 100644 --- a/app/Console/Commands/Shopify/ShopifyInventorySyncCommand.php +++ b/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php @@ -2,14 +2,16 @@ declare(strict_types=1); -namespace App\Console\Commands\Shopify; +namespace App\Console\Commands\Connectors\Shopify; use Illuminate\Console\Command; use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Connectors\Shopify\Enums\StatusEnum; use Kanvas\Connectors\Shopify\Services\ShopifyInventoryService; +use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Products\Models\Products; +use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Users\Models\UserCompanyApps; class ShopifyInventorySyncCommand extends Command @@ -19,7 +21,7 @@ class ShopifyInventorySyncCommand extends Command * * @var string */ - protected $signature = 'kanvas:inventory-shopify-sync {app_id} {company_id}'; + protected $signature = 'kanvas:inventory-shopify-sync {app_id} {company_id} {warehouse_id} {channel_id}'; /** * The console command description. @@ -37,26 +39,24 @@ public function handle() { $app = Apps::getById((int) $this->argument('app_id')); $company = Companies::getById((int) $this->argument('company_id')); + $channel = Channels::getByIdFromCompany((int) $this->argument('channel_id'), $company); + $warehouses = Warehouses::getByIdFromCompany((int) $this->argument('warehouse_id'), $company); $associatedApps = UserCompanyApps::where('apps_id', $app->getId()) - ->where('companies_id', $company->getId())->first(); + ->where('companies_id', $company->getId())->first(); $companyData = $associatedApps->company; $this->info("Checking company {$companyData->getId()} \n"); $products = Products::where('companies_id', $companyData->getId()) - ->where('apps_id', $app->getId()) - ->get(); + ->where('apps_id', $app->getId()) + ->get(); foreach ($products as $product) { $this->info("Checking product {$product->getId()} {$product->name} \n"); - foreach ($product->variants as $variant) { - $variant->warehouses->map(function ($warehouses) use ($variant) { - $shopifyService = new ShopifyInventoryService($variant->app, $variant->company, $warehouses); - $shopifyService->saveProduct($variant->product, StatusEnum::ACTIVE); - }); - } + $shopifyService = new ShopifyInventoryService($product->app, $product->company, $warehouses); + $shopifyService->saveProduct($product, StatusEnum::ACTIVE, $channel); } return; } diff --git a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php index 33aa9d48f..567637213 100644 --- a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php +++ b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php @@ -10,10 +10,8 @@ use Kanvas\Connectors\Shopify\Enums\StatusEnum; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Products\Models\Products; -use Kanvas\Inventory\Regions\Models\Regions; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Warehouses\Models\Warehouses; -use Kanvas\Social\Channels\Models\Channel; use PHPShopify\ShopifySDK; use Throwable; @@ -32,7 +30,7 @@ public function __construct( /** * Map and create an product on shopify sdk. */ - public function saveProduct(Products $product, StatusEnum $status): array + public function saveProduct(Products $product, StatusEnum $status, ?Channels $channel = null): array { $shopifyProductId = $product->getShopifyId($this->warehouses->regions); @@ -54,15 +52,19 @@ public function saveProduct(Products $product, StatusEnum $status): array $response = $this->shopifySdk->Product->post($productInfo); $shopifyProductId = $response['id']; $product->setShopifyId($this->warehouses->regions, $shopifyProductId); + + foreach ($response['variants'] as $shopifyVariant) { + $variant = $product->variants('sku', $shopifyVariant['sku'])->first(); + if ($variant->getShopifyId($this->warehouses->regions) === null) { + $variant->setShopifyId($this->warehouses->regions, $shopifyVariant['id']); + } + } } else { $shopifyProduct = $this->shopifySdk->Product($shopifyProductId); $response = $shopifyProduct->put($productInfo); - } - foreach ($response['variants'] as $shopifyVariant) { - $variant = $product->variants('sku', $shopifyVariant['sku'])->first(); - if ($variant->getShopifyId($this->warehouses->regions) === null) { - $variant->setShopifyId($this->warehouses->regions, $shopifyVariant['id']); + foreach ($product->variants as $variant) { + $this->saveVariant($variant, $channel); } } @@ -82,7 +84,7 @@ public function saveProduct(Products $product, StatusEnum $status): array /** * Map the data from the variant into the array */ - public function mapVariant(Variants $variant, ?Channel $channel = null): array + public function mapVariant(Variants $variant, ?Channels $channel = null): array { $warehouseInfo = $variant->variantWarehouses()->where('warehouses_id', $this->warehouses->getId()); @@ -109,6 +111,7 @@ public function mapVariant(Variants $variant, ?Channel $channel = null): array 'inventory_policy' => 'deny', ]; + print_r($shopifyVariantInfo); die(); if ($variant->product->getShopifyId($this->warehouses->regions)) { $shopifyVariantInfo['product_id'] = $variant->product->getShopifyId($this->warehouses->regions); } From 4ce020b174a879f97b58092665d24d94b020570f Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 18 May 2024 17:53:58 -0400 Subject: [PATCH 11/54] fix: shopify sync --- .../Connectors/Shopify/Services/ShopifyInventoryService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php index 567637213..89915937a 100644 --- a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php +++ b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php @@ -111,7 +111,6 @@ public function mapVariant(Variants $variant, ?Channels $channel = null): array 'inventory_policy' => 'deny', ]; - print_r($shopifyVariantInfo); die(); if ($variant->product->getShopifyId($this->warehouses->regions)) { $shopifyVariantInfo['product_id'] = $variant->product->getShopifyId($this->warehouses->regions); } From 30e87519df8421f5c3680b6ce9ec910b8dcc3fb5 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Mon, 20 May 2024 01:39:35 -0400 Subject: [PATCH 12/54] fix: duplicate users on get --- src/Kanvas/Users/Repositories/UsersRepository.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Kanvas/Users/Repositories/UsersRepository.php b/src/Kanvas/Users/Repositories/UsersRepository.php index c7337b314..881b8faba 100644 --- a/src/Kanvas/Users/Repositories/UsersRepository.php +++ b/src/Kanvas/Users/Repositories/UsersRepository.php @@ -35,6 +35,7 @@ public static function findUsersByArray(array $users, ?CompanyInterface $company }) ->whereIn('users.id', $users) ->orWhereIn('users.email', $users) + ->groupBy('users.id') ->get(); } From c9e40fcf92de77076cffcf65232842eb2521637b Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 20 May 2024 10:34:30 -0400 Subject: [PATCH 13/54] refact: fix upload iamgse --- .../Shopify/Services/ShopifyImageService.php | 107 ++++++++++++++++++ .../Services/ShopifyInventoryService.php | 30 ++--- .../Filesystem/Traits/HasFilesystemTrait.php | 5 +- 3 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 src/Domains/Connectors/Shopify/Services/ShopifyImageService.php diff --git a/src/Domains/Connectors/Shopify/Services/ShopifyImageService.php b/src/Domains/Connectors/Shopify/Services/ShopifyImageService.php new file mode 100644 index 000000000..eaf08d473 --- /dev/null +++ b/src/Domains/Connectors/Shopify/Services/ShopifyImageService.php @@ -0,0 +1,107 @@ +shopifySdk = Client::getInstance($app, $company, $region); + } + + public function processEntityImage(Products|Variants $entity): int + { + $totalUploaded = 0; + if (! $entity->files->count()) { + return $totalUploaded; + } + + foreach ($entity->files as $file) { + if ($entity instanceof Products) { + if ($this->addImage($entity, $file->url)) { + $totalUploaded++; + } + } else { + if ($this->addVariantImage($entity, $file->url)) { + $totalUploaded++; + } + } + } + + return $totalUploaded; + } + + public function addImage(Products $product, string $imageUrl): ?array + { + try { + $shopifyProduct = $this->shopifySdk->Product($product->getShopifyId($this->region)); + + $fileName = pathinfo($imageUrl, PATHINFO_BASENAME); + // Check if the image already exists + $existingImages = $shopifyProduct->Image->get(); + foreach ($existingImages as $image) { + if ($image['alt'] === $fileName) { + return null; // Image already exists, no need to upload + } + } + + // Add the image if it does not exist + $response = $shopifyProduct->Image->post(['src' => $imageUrl, 'alt' => $fileName]); + return $response; + } catch (Exception $e) { + throw new Exception('Failed to add image to Shopify product: ' . $e->getMessage()); + } + } + + public function addVariantImage(Variants $variant, string $imageUrl): bool + { + try { + $shopifyProduct = $this->shopifySdk->Product($variant->product->getShopifyId($this->region)); + $shopifyVariant = $shopifyProduct->Variant($variant->getShopifyId($this->region)); + + // Check if the image already exists + $existingImages = $shopifyProduct->Image->get(); + $fileName = pathinfo($imageUrl, PATHINFO_BASENAME); + + foreach ($existingImages as $image) { + if ($image['alt'] === $fileName) { + return false; // Image already exists, no need to upload + } + } + + // Add the image if it does not exist + $image = $this->addImage($variant->product, $imageUrl); + + if ($image) { + $shopifyVariantData = $shopifyVariant->get(); + $shopifyVariant->put(['image_id' => $image['id']]); + + if ($shopifyVariantData['image_id'] !== null) { + $shopifyProduct->Image($shopifyVariantData['image_id'])->delete(); + } + + return true; + } + + return false; + } catch (Exception $e) { + throw new Exception('Failed to add image to Shopify variant: ' . $e->getMessage()); + } + } +} diff --git a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php index 89915937a..7940ac34b 100644 --- a/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php +++ b/src/Domains/Connectors/Shopify/Services/ShopifyInventoryService.php @@ -18,6 +18,7 @@ class ShopifyInventoryService { protected ShopifySDK $shopifySdk; + protected ShopifyImageService $shopifyImageService; public function __construct( protected AppInterface $app, @@ -25,6 +26,7 @@ public function __construct( protected Warehouses $warehouses, ) { $this->shopifySdk = Client::getInstance($app, $company, $warehouses->regions); + $this->shopifyImageService = new ShopifyImageService($app, $company, $warehouses->regions); } /** @@ -78,6 +80,8 @@ public function saveProduct(Products $product, StatusEnum $status, ?Channels $ch //do nothing } + $this->shopifyImageService->processEntityImage($product); + return $response; } @@ -101,16 +105,21 @@ public function mapVariant(Variants $variant, ?Channels $channel = null): array $price = $warehouseInfo?->price ?? 0; } + $quantity = $warehouseInfo?->quantity ?? 0; $shopifyVariantInfo = [ 'option1' => $variant->sku ?? $variant->name, 'sku' => $variant->sku, 'barcode' => $variant->barcode, 'price' => $price, - 'quantity' => $warehouseInfo?->quantity ?? 0, + 'quantity' => $quantity, 'compare_at_price' => $discountedPrice ?? 0, 'inventory_policy' => 'deny', ]; + if ($quantity > 0) { + $this->setStock($variant, $channel); + } + if ($variant->product->getShopifyId($this->warehouses->regions)) { $shopifyVariantInfo['product_id'] = $variant->product->getShopifyId($this->warehouses->regions); } @@ -141,6 +150,8 @@ public function saveVariant(Variants $variant, Channels $channel = null): array } } + $this->shopifyImageService->processEntityImage($variant); + return $response; } @@ -198,21 +209,4 @@ public function publishProduct(Products $product): array { return $this->changeProductStatus($product, StatusEnum::ACTIVE); } - - public function addImages(Variants $variant, string $imageUrl): void - { - $shopifyProduct = $this->shopifySdk->Product($variant->product->getShopifyId($this->warehouses->regions)); - $shopifyVariant = $shopifyProduct->Variant($variant->getShopifyId($this->warehouses->regions)); - - $shopifyVariantData = $shopifyVariant->get(); - - //product will have all the images of its variants - $image = $shopifyProduct->Image->post(['src' => $imageUrl]); - - $shopifyVariant->put(['image_id' => $image['id']]); - - if ($shopifyVariantData['image_id'] !== null) { - $shopifyProduct->Image($shopifyVariantData['image_id'])->delete(); - } - } } diff --git a/src/Kanvas/Filesystem/Traits/HasFilesystemTrait.php b/src/Kanvas/Filesystem/Traits/HasFilesystemTrait.php index 7d111c3ca..203cc2f15 100644 --- a/src/Kanvas/Filesystem/Traits/HasFilesystemTrait.php +++ b/src/Kanvas/Filesystem/Traits/HasFilesystemTrait.php @@ -125,6 +125,9 @@ public function getFileByName(string $name): ?FilesystemEntities */ public function files(): HasManyThrough { + $app = $this->app ?? app(Apps::class); + $systemModule = SystemModulesRepository::getByModelName(get_class($this), $app); + return $this->hasManyThrough( Filesystem::class, FilesystemEntities::class, @@ -134,7 +137,7 @@ public function files(): HasManyThrough 'filesystem_id' )->where( 'filesystem_entities.system_modules_id', - SystemModulesRepository::getByModelName(get_class($this))->getId() + $systemModule->getId() ) ->where( 'filesystem_entities.is_deleted', From 037c4c3162ae5c656956e6a05ec165a8a26479cd Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 20 May 2024 11:19:14 -0400 Subject: [PATCH 14/54] refact: fix upload iamgse --- .../Integration/Shopify/VariantTest.php | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/Connectors/Integration/Shopify/VariantTest.php b/tests/Connectors/Integration/Shopify/VariantTest.php index 07201fbb5..19ef734c3 100644 --- a/tests/Connectors/Integration/Shopify/VariantTest.php +++ b/tests/Connectors/Integration/Shopify/VariantTest.php @@ -4,14 +4,12 @@ namespace Tests\Connectors\Integration\Shopify; -use Kanvas\Connectors\Shopify\DataTransferObject\Shopify; use Kanvas\Connectors\Shopify\Enums\StatusEnum; -use Kanvas\Connectors\Shopify\Services\ShopifyConfigurationService; +use Kanvas\Connectors\Shopify\Services\ShopifyImageService; use Kanvas\Connectors\Shopify\Services\ShopifyInventoryService; -use Tests\Connectors\Traits\HasShopifyConfiguration; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Products\Models\Products; -use Kanvas\Inventory\Regions\Models\Regions; +use Tests\Connectors\Traits\HasShopifyConfiguration; use Tests\TestCase; final class VariantTest extends TestCase @@ -96,18 +94,18 @@ public function testSetImage() $warehouse ); + $shopifyImageService = new ShopifyImageService( + $product->app, + $product->company, + $warehouse->region + ); $shopifyProduct = $shopify->saveProduct($product, StatusEnum::ACTIVE); $url = 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'; foreach ($product->variants as $variant) { - $shopify->saveVariant($variant); - $shopifyVariantResponse = $shopify->addImages($variant, $url); - - $this->assertEquals( - $variant->image, - $shopifyVariantResponse - ); + $this->assertTrue($shopifyImageService->addVariantImage($variant, $url)); + //$shopifyVariantResponse = $shopify->addImages($variant, $url); } } } From cf769117a02e18025dc01e522b7ce156acc2989d Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 20 May 2024 11:29:37 -0400 Subject: [PATCH 15/54] Remove warehouses assignation from service --- .../Variants/Services/VariantService.php | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 3f1420c6b..306b894a8 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -51,9 +51,7 @@ public static function createVariantsFromArray(Products $product, array $variant if (isset($variant['attributes'])) { $variantModel->addAttributes($user, $variant['attributes']); } - if (! $variantDto->warehouse_id) { - $variantDto->warehouse_id = Warehouses::getDefault($company)->getId(); - } + if (isset($variant['status']['id'])) { $status = StatusRepository::getById( (int) $variant['status']['id'], @@ -68,24 +66,28 @@ public static function createVariantsFromArray(Products $product, array $variant } } - $warehouse = WarehouseRepository::getById($variantDto->warehouse_id, $company, $variantDto->product->app); - - if (isset($variant['warehouse']['status'])) { - $variant['warehouse']['status_id'] = StatusRepository::getById( - (int) $variant['warehouse']['status']['id'], - $company - )->getId(); + if (isset($variant['warehouses'])) { + foreach ($variant['warehouses'] as $warehouseData) { + $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); + + VariantService::addToWarehouses( + $variantModel, + $warehouse, + $company, + $warehouseData + ); + } } else { - $variant['warehouse']['status_id'] = Status::getDefault($company)->getId(); - } - - if ($variantDto->sku && (! isset($variant['warehouse']['sku']) || ! $variant['warehouse']['sku'])) { - $variant['warehouse']['sku'] = $variantDto->sku; + $warehouse = Warehouses::getDefault($company); + + VariantService::addToWarehouses( + $variantModel, + $warehouse, + $company, + [] + ); } - $variantWarehouses = VariantsWarehouses::viaRequest($variant['warehouse'] ?? []); - - (new AddToWarehouse($variantModel, $warehouse, $variantWarehouses))->execute(); $variantsData[] = $variantModel; } @@ -206,6 +208,9 @@ public static function addToWarehouses( $warehousesInfo['status_id'] = $status ? $status->getId() : null; $variantWarehouses = VariantsWarehouses::viaRequest($warehousesInfo ?? []); + if ($variant->sku && (! isset($warehousesInfo['sku']) || ! $warehousesInfo['sku'])) { + $warehousesInfo['sku'] = $variant->sku; + } return (new AddToWarehouse($variant, $warehouse, $variantWarehouses))->execute(); } } From 62ae308a176b6b62459589c2666cfc0ce23975e6 Mon Sep 17 00:00:00 2001 From: arfenis Date: Mon, 20 May 2024 11:31:39 -0400 Subject: [PATCH 16/54] stylo --- src/Domains/Inventory/Variants/Services/VariantService.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 306b894a8..82458c02c 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -69,7 +69,6 @@ public static function createVariantsFromArray(Products $product, array $variant if (isset($variant['warehouses'])) { foreach ($variant['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); - VariantService::addToWarehouses( $variantModel, $warehouse, @@ -79,7 +78,6 @@ public static function createVariantsFromArray(Products $product, array $variant } } else { $warehouse = Warehouses::getDefault($company); - VariantService::addToWarehouses( $variantModel, $warehouse, From 24897dec71d051170b7623e92ebd948f1075666f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 23:03:46 +0000 Subject: [PATCH 17/54] --- updated-dependencies: - dependency-name: laravel-workflow/laravel-workflow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a854c6ce6..2eb4e5db6 100644 --- a/composer.lock +++ b/composer.lock @@ -3849,16 +3849,16 @@ }, { "name": "laravel-workflow/laravel-workflow", - "version": "1.0.24", + "version": "1.0.25", "source": { "type": "git", "url": "https://github.com/laravel-workflow/laravel-workflow.git", - "reference": "55e26abbd422bde7eb6a63f23ac92f99e1467440" + "reference": "b60f98e5be663ae40420398aeb2dd9782df09330" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-workflow/laravel-workflow/zipball/55e26abbd422bde7eb6a63f23ac92f99e1467440", - "reference": "55e26abbd422bde7eb6a63f23ac92f99e1467440", + "url": "https://api.github.com/repos/laravel-workflow/laravel-workflow/zipball/b60f98e5be663ae40420398aeb2dd9782df09330", + "reference": "b60f98e5be663ae40420398aeb2dd9782df09330", "shasum": "" }, "require": { @@ -3900,9 +3900,9 @@ "description": "Durable workflow engine that allows users to write long running persistent distributed workflows (orchestrations) in PHP powered by Laravel queues.", "support": { "issues": "https://github.com/laravel-workflow/laravel-workflow/issues", - "source": "https://github.com/laravel-workflow/laravel-workflow/tree/1.0.24" + "source": "https://github.com/laravel-workflow/laravel-workflow/tree/1.0.25" }, - "time": "2024-04-24T03:34:22+00:00" + "time": "2024-05-19T10:16:44+00:00" }, { "name": "laravel/framework", From 9fdb3968e097b55d3a3cc149694f243e4180762f Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 20 May 2024 20:51:44 -0400 Subject: [PATCH 18/54] refact: topics and reactions --- graphql/schemas/Social/reactions.graphql | 6 +++--- graphql/schemas/Social/topics.graphql | 2 +- tests/GraphQL/Social/ReactionTest.php | 10 +++++----- tests/GraphQL/Social/TopicsTest.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/graphql/schemas/Social/reactions.graphql b/graphql/schemas/Social/reactions.graphql index 2f5b9b285..993185bc3 100644 --- a/graphql/schemas/Social/reactions.graphql +++ b/graphql/schemas/Social/reactions.graphql @@ -50,7 +50,7 @@ extend type Mutation @guard { } extend type Query { - getReactions( + reactions( where: _ @whereConditions( columns: ["id", "name", "apps_id", "companies_id", "icon"] @@ -62,9 +62,9 @@ extend type Query { defaultCount: 25 scopes: ["fromApp"] ) - getReaction(id: ID! @eq): Reaction + reaction(id: ID! @eq): Reaction @find(model: "Kanvas\\Social\\Reactions\\Models\\Reaction") - getUserReactions( + userReactions( where: _ @whereConditions( columns: [ diff --git a/graphql/schemas/Social/topics.graphql b/graphql/schemas/Social/topics.graphql index 0645d94b9..c6df9f9c8 100644 --- a/graphql/schemas/Social/topics.graphql +++ b/graphql/schemas/Social/topics.graphql @@ -18,7 +18,7 @@ input TopicInput { } extend type Query { - getTopics( + topics( where: _ @whereConditions( columns: [ diff --git a/tests/GraphQL/Social/ReactionTest.php b/tests/GraphQL/Social/ReactionTest.php index 03def7709..48dd686ed 100644 --- a/tests/GraphQL/Social/ReactionTest.php +++ b/tests/GraphQL/Social/ReactionTest.php @@ -173,8 +173,8 @@ public function testGetReactions() $response = $this->graphQL(/** @lang GRAPHQL */ ' - query getReactions { - getReactions( + query reactions { + reactions( orderBy: {column: ID, order: DESC} ) { data { @@ -185,9 +185,9 @@ public function testGetReactions() } }' ); - $this->assertArrayHasKey('getReactions', $response->json('data')); - $this->assertArrayHasKey('data', $response->json('data.getReactions')); - $this->assertArrayHasKey('id', $response->json('data.getReactions.data.0')); + $this->assertArrayHasKey('reactions', $response->json('data')); + $this->assertArrayHasKey('data', $response->json('data.reactions')); + $this->assertArrayHasKey('id', $response->json('data.reactions.data.0')); } public function testReactToEntity() diff --git a/tests/GraphQL/Social/TopicsTest.php b/tests/GraphQL/Social/TopicsTest.php index 05d97ccd3..f2a55d767 100644 --- a/tests/GraphQL/Social/TopicsTest.php +++ b/tests/GraphQL/Social/TopicsTest.php @@ -135,7 +135,7 @@ public function testGetTopic() $this->graphQL( ' { - getTopics { + topics { data { id name From 65b5c81c59fa9ade1895b46512a2a0a1bf8486df Mon Sep 17 00:00:00 2001 From: Rafael White Date: Tue, 21 May 2024 11:46:10 -0400 Subject: [PATCH 19/54] remove nginx container from franken docker compose --- docker-compose.franken.yml | 150 ++++++++++++++----------------------- 1 file changed, 58 insertions(+), 92 deletions(-) diff --git a/docker-compose.franken.yml b/docker-compose.franken.yml index fbf050bee..44271e4bf 100644 --- a/docker-compose.franken.yml +++ b/docker-compose.franken.yml @@ -3,7 +3,6 @@ services: container_name: php${APP_CONTAINER_NAME} ports: - "80:80" - - "8080:8080" build: context: . dockerfile: franken.Dockerfile @@ -23,24 +22,6 @@ services: depends_on: - mysql - redis - # nginx: - # image: nginx:latest - # container_name: nginx${APP_CONTAINER_NAME} - # ports: - # - "80:80" - # links: - # - php - # volumes: - # - '.:/var/www/html' - # - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf - # networks: - # - sail - # depends_on: - # - php - # healthcheck: - # test: ["CMD", "service", "nginx", "status"] - # retries: 3 - # timeout: 5s mysql: container_name: mysql${APP_CONTAINER_NAME} image: 'mysql:8.3.0' @@ -76,79 +57,64 @@ services: retries: 3 timeout: 5s - # rabbitmq: - # container_name: rabbitmq${APP_CONTAINER_NAME} - # image: rabbitmq:3.9.21-management-alpine - # hostname: "rabbit" - # labels: - # NAME: "rabbitmq1" - # volumes: - # - "sail-rabbitmq:/var/lib/rabbitmq" - # healthcheck: - # test: rabbitmq-diagnostics -q ping - # interval: 30s - # timeout: 30s - # retries: 3 - # ports: - # - "15672:15672" - # - "5672:5672" - # networks: - # - sail - # mailpit: - # image: 'axllent/mailpit:latest' - # ports: - # - '${FORWARD_MAILPIT_PORT:-1025}:1025' - # - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' - # networks: - # - sail - # phpmyadmin: - # image: phpmyadmin/phpmyadmin:5.0.2 - # container_name: phpmyadmin${APP_CONTAINER_NAME} - # restart: always - # environment: - # - PMA_HOST=mysql - # - MYSQL_ROOT_PASSWORD=${DB_PASSWORD} - # ports: - # - "9010:80" - - # volumes: - # - pma:/var/www/html - - # networks: - # - sail - # minio1: - # image: minio/minio - # container_name: minio${APP_CONTAINER_NAME} - # restart: always - # environment: - # MINIO_ACCESS_KEY: minio - # MINIO_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY} - # command: server /data --console-address ":9001" - # ports: - # - "9002:9000" - # - "9001:9001" - # volumes: - # - s3data:/data - # networks: - # - sail - # meilisearch: - # container_name: meilisearch - # image: getmeili/meilisearch:v1.1 - # environment: - # - http_proxy - # - https_proxy - # - MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey} - # - MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true} - # - MEILI_ENV=${MEILI_ENV:-development} - # - MEILI_LOG_LEVEL - # - MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms} - # ports: - # - ${MEILI_PORT:-7700}:7700 - # networks: - # - sail - # volumes: - # - meilisearch:/data.ms - # restart: unless-stopped + rabbitmq: + container_name: rabbitmq${APP_CONTAINER_NAME} + image: rabbitmq:3.9.21-management-alpine + hostname: "rabbit" + labels: + NAME: "rabbitmq1" + volumes: + - "sail-rabbitmq:/var/lib/rabbitmq" + healthcheck: + test: rabbitmq-diagnostics -q ping + interval: 30s + timeout: 30s + retries: 3 + ports: + - "15672:15672" + - "5672:5672" + networks: + - sail + mailpit: + image: 'axllent/mailpit:latest' + ports: + - '${FORWARD_MAILPIT_PORT:-1025}:1025' + - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' + networks: + - sail + minio1: + image: minio/minio + container_name: minio${APP_CONTAINER_NAME} + restart: always + environment: + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY} + command: server /data --console-address ":9001" + ports: + - "9002:9000" + - "9001:9001" + volumes: + - s3data:/data + networks: + - sail + meilisearch: + container_name: meilisearch + image: getmeili/meilisearch:v1.1 + environment: + - http_proxy + - https_proxy + - MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey} + - MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true} + - MEILI_ENV=${MEILI_ENV:-development} + - MEILI_LOG_LEVEL + - MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms} + ports: + - ${MEILI_PORT:-7700}:7700 + networks: + - sail + volumes: + - meilisearch:/data.ms + restart: unless-stopped networks: sail: driver: bridge From 94d7951fd618f435a031e5ce34ebe5b9e223117f Mon Sep 17 00:00:00 2001 From: Rafael White Date: Tue, 21 May 2024 16:33:37 -0400 Subject: [PATCH 20/54] add schedule run to api pods. --- helm/templates/pod-api.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm/templates/pod-api.yaml b/helm/templates/pod-api.yaml index 231305489..ff146ced1 100644 --- a/helm/templates/pod-api.yaml +++ b/helm/templates/pod-api.yaml @@ -92,7 +92,8 @@ spec: chmod -R 777 /var/www/html/bootstrap/cache && \ cd /var/www/html \ && php artisan lighthouse:cache \ - && php artisan config:cache" + && php artisan config:cache \ + && php artisan schedule:run" ] securityContext: fsGroup: 65533 From 0e132dfae384a51167328c22df19242ddc26b067 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Tue, 21 May 2024 16:36:22 -0400 Subject: [PATCH 21/54] comment health cronjob --- helm/templates/cronjob-health-checker.yaml | 126 ++++++++++----------- helm/values.yaml | 6 +- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/helm/templates/cronjob-health-checker.yaml b/helm/templates/cronjob-health-checker.yaml index 2e9514b8d..0b9bc55de 100644 --- a/helm/templates/cronjob-health-checker.yaml +++ b/helm/templates/cronjob-health-checker.yaml @@ -1,63 +1,63 @@ -apiVersion: batch/v1 -kind: CronJob -metadata: - name: laravel-schedule -spec: - successfulJobsHistoryLimit: 0 - failedJobsHistoryLimit: 0 - schedule: "* * * * *" - jobTemplate: - spec: - template: - spec: - volumes: - - name: envconfigmap - configMap: - name: envconfigmap - items: - - key: kanvasconfigmap - path: .env - defaultMode: 432 - - name: webroot - emptyDir: {} - - name: phpini - configMap: - name: php-ini-config - items: - - key: phpini - path: phpupdate.ini - containers: - - name: {{.Values.deployments.api.containerName}} - image: {{.Values.apiImage}} - imagePullPolicy: Always - volumeMounts: - - name: envconfigmap - mountPath: /app/.env - subPath: .env - - name: phpini - mountPath: /usr/local/etc/php/conf.d/phpupdate.ini - subPath: phpupdate.ini - - name: webroot - mountPath: "/var/www/html" - resources: - requests: - memory: "512M" - cpu: "300m" - limits: - memory: "1G" - cpu: "700m" - command: - [ - "/bin/sh", - "-c", - "cp -R /app/. /var/www/html && \ - chmod -R 755 /var/www/html && \ - chmod -R 777 /var/www/html/storage && \ - chmod -R 777 /var/www/html/storage/logs && \ - chmod -R 777 /var/www/html/bootstrap/cache && \ - cd /var/www/html \ - && composer install --no-dev --optimize-autoloader \ - && php artisan config:cache \ - && php artisan schedule:run" - ] - restartPolicy: OnFailure \ No newline at end of file +# apiVersion: batch/v1 +# kind: CronJob +# metadata: +# name: laravel-schedule +# spec: +# successfulJobsHistoryLimit: 0 +# failedJobsHistoryLimit: 0 +# schedule: "* * * * *" +# jobTemplate: +# spec: +# template: +# spec: +# volumes: +# - name: envconfigmap +# configMap: +# name: envconfigmap +# items: +# - key: kanvasconfigmap +# path: .env +# defaultMode: 432 +# - name: webroot +# emptyDir: {} +# - name: phpini +# configMap: +# name: php-ini-config +# items: +# - key: phpini +# path: phpupdate.ini +# containers: +# - name: {{.Values.deployments.api.containerName}} +# image: {{.Values.apiImage}} +# imagePullPolicy: Always +# volumeMounts: +# - name: envconfigmap +# mountPath: /app/.env +# subPath: .env +# - name: phpini +# mountPath: /usr/local/etc/php/conf.d/phpupdate.ini +# subPath: phpupdate.ini +# - name: webroot +# mountPath: "/var/www/html" +# resources: +# requests: +# memory: "512M" +# cpu: "300m" +# limits: +# memory: "1G" +# cpu: "700m" +# command: +# [ +# "/bin/sh", +# "-c", +# "cp -R /app/. /var/www/html && \ +# chmod -R 755 /var/www/html && \ +# chmod -R 777 /var/www/html/storage && \ +# chmod -R 777 /var/www/html/storage/logs && \ +# chmod -R 777 /var/www/html/bootstrap/cache && \ +# cd /var/www/html \ +# && composer install --no-dev --optimize-autoloader \ +# && php artisan config:cache \ +# && php artisan schedule:run" +# ] +# restartPolicy: OnFailure \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml index b64654f27..a2a11c08a 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -33,9 +33,9 @@ deployments: socialQueue: name: kanvas-social containerName: kanvas-social - healthcheck: - name: healthcheck - containerName: healthcheck + # healthcheck: + # name: healthcheck + # containerName: healthcheck # Services Values From d4f61950f74944642bbc51fd52e92623d6d99761 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Tue, 21 May 2024 16:56:54 -0400 Subject: [PATCH 22/54] add another pod for the laravel scheduler --- helm/templates/pod-api.yaml | 3 +- helm/templates/pod-laravel-scheduler.yaml | 99 +++++++++++++++++++++++ helm/values.yaml | 6 +- 3 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 helm/templates/pod-laravel-scheduler.yaml diff --git a/helm/templates/pod-api.yaml b/helm/templates/pod-api.yaml index ff146ced1..231305489 100644 --- a/helm/templates/pod-api.yaml +++ b/helm/templates/pod-api.yaml @@ -92,8 +92,7 @@ spec: chmod -R 777 /var/www/html/bootstrap/cache && \ cd /var/www/html \ && php artisan lighthouse:cache \ - && php artisan config:cache \ - && php artisan schedule:run" + && php artisan config:cache" ] securityContext: fsGroup: 65533 diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml new file mode 100644 index 000000000..78a97b103 --- /dev/null +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -0,0 +1,99 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.Values.deployments.laravelScheduler.name}} + namespace: {{.Values.namespace}} +spec: + replicas: 1 + selector: + matchLabels: + app: {{.Values.deployments.laravelScheduler.name}} + template: + metadata: + labels: + app: {{.Values.deployments.laravelScheduler.name}} + type: api + annotations: + instrumentation.opentelemetry.io/inject-java: "true" + spec: + volumes: + - name: envconfigmap + configMap: + name: envconfigmap + items: + - key: kanvasconfigmap + path: .env + defaultMode: 432 + - name: webroot + emptyDir: {} + - name: config + configMap: + name: nginx-php-api + items: + - key: config + path: default.conf + - name: nginx-config + configMap: + name: nginx-config + items: + - key: nginx.conf + path: nginx.conf + containers: + - name: nginx + image: nginx:1.24 + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - name: nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + - name: config + mountPath: /etc/nginx/conf.d + - name: webroot + mountPath: "/var/www/html" + resources: + requests: + memory: "128M" + cpu: "100m" + limits: + memory: "512M" + cpu: "200m" + - name: {{.Values.deployments.laravelScheduler.containerName}} + image: {{.Values.apiImage}} + imagePullPolicy: Always + ports: + - containerPort: 8080 + protocol: TCP + volumeMounts: + - name: envconfigmap + mountPath: /app/.env + subPath: .env + - name: webroot + mountPath: "/var/www/html" + resources: + requests: + memory: "256M" + cpu: "300m" + limits: + memory: "600M" + cpu: "800m" + lifecycle: + postStart: + exec: + command: + [ + "/bin/sh", + "-c", + "cp -R /app/. /var/www/html && \ + chmod -R 755 /var/www/html && \ + chmod -R 777 /var/www/html/storage && \ + chmod -R 777 /var/www/html/storage/logs && \ + chmod -R 777 /var/www/html/bootstrap/cache && \ + cd /var/www/html \ + && php artisan lighthouse:cache \ + && php artisan config:cache \ + && php artisan schedule:run" + ] + securityContext: + fsGroup: 65533 diff --git a/helm/values.yaml b/helm/values.yaml index a2a11c08a..d0e39a686 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -33,9 +33,9 @@ deployments: socialQueue: name: kanvas-social containerName: kanvas-social - # healthcheck: - # name: healthcheck - # containerName: healthcheck + laravelScheduler: + name: scheduler + containerName: scheduler # Services Values From c3cce6f48bf1a8ed2479f86bbec19a31fe92dcc1 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Tue, 21 May 2024 17:00:44 -0400 Subject: [PATCH 23/54] run with work instead of run --- helm/templates/pod-laravel-scheduler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index 78a97b103..ccf2e00fc 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -93,7 +93,7 @@ spec: cd /var/www/html \ && php artisan lighthouse:cache \ && php artisan config:cache \ - && php artisan schedule:run" + && php artisan schedule:work" ] securityContext: fsGroup: 65533 From cd38bc9b2f000731f0eab774de7c4dd786121a7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 22:32:00 +0000 Subject: [PATCH 24/54] --- updated-dependencies: - dependency-name: laravel/octane dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index 2eb4e5db6..309ffc94e 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.7.0", + "version": "v11.8.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "e5ac72f513f635f208024aa76b8a04efc1b47f93" + "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/e5ac72f513f635f208024aa76b8a04efc1b47f93", - "reference": "e5ac72f513f635f208024aa76b8a04efc1b47f93", + "url": "https://api.github.com/repos/laravel/framework/zipball/ceb892a25817c888ef3df4d1a2af9cac53978300", + "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300", "shasum": "" }, "require": { @@ -4040,7 +4040,7 @@ "ext-pcntl": "Required to use all features of the queue worker and console signal trapping.", "ext-pdo": "Required to use all database features.", "ext-posix": "Required to use all features of the queue worker.", - "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0|^6.0).", "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", "filp/whoops": "Required for friendly error pages in development (^2.14.3).", "laravel/tinker": "Required to use the tinker console command (^2.0).", @@ -4107,20 +4107,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-05-07T13:41:51+00:00" + "time": "2024-05-21T17:57:45+00:00" }, { "name": "laravel/octane", - "version": "v2.3.10", + "version": "v2.3.11", "source": { "type": "git", "url": "https://github.com/laravel/octane.git", - "reference": "61a3e69eaba9cf71f038c9950bec1a84d9c63223" + "reference": "59e1201d8259e67cf8b7f3af4646482a096d0a8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/octane/zipball/61a3e69eaba9cf71f038c9950bec1a84d9c63223", - "reference": "61a3e69eaba9cf71f038c9950bec1a84d9c63223", + "url": "https://api.github.com/repos/laravel/octane/zipball/59e1201d8259e67cf8b7f3af4646482a096d0a8b", + "reference": "59e1201d8259e67cf8b7f3af4646482a096d0a8b", "shasum": "" }, "require": { @@ -4196,20 +4196,20 @@ "issues": "https://github.com/laravel/octane/issues", "source": "https://github.com/laravel/octane" }, - "time": "2024-05-07T13:19:11+00:00" + "time": "2024-05-16T21:41:23+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.21", + "version": "v0.1.22", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "23ea808e8a145653e0ab29e30d4385e49f40a920" + "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/23ea808e8a145653e0ab29e30d4385e49f40a920", - "reference": "23ea808e8a145653e0ab29e30d4385e49f40a920", + "url": "https://api.github.com/repos/laravel/prompts/zipball/37f94de71758dbfbccc9d299b0e5eb76e02a40f5", + "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.21" + "source": "https://github.com/laravel/prompts/tree/v0.1.22" }, - "time": "2024-04-30T12:46:16+00:00" + "time": "2024-05-10T19:22:18+00:00" }, { "name": "laravel/sanctum", From 82da812ee0eeac156ee1f046c27be19827b7da33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 22:32:25 +0000 Subject: [PATCH 25/54] --- updated-dependencies: - dependency-name: laravel/framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 2eb4e5db6..81b76433f 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.7.0", + "version": "v11.8.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "e5ac72f513f635f208024aa76b8a04efc1b47f93" + "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/e5ac72f513f635f208024aa76b8a04efc1b47f93", - "reference": "e5ac72f513f635f208024aa76b8a04efc1b47f93", + "url": "https://api.github.com/repos/laravel/framework/zipball/ceb892a25817c888ef3df4d1a2af9cac53978300", + "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300", "shasum": "" }, "require": { @@ -4040,7 +4040,7 @@ "ext-pcntl": "Required to use all features of the queue worker and console signal trapping.", "ext-pdo": "Required to use all database features.", "ext-posix": "Required to use all features of the queue worker.", - "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0|^6.0).", "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", "filp/whoops": "Required for friendly error pages in development (^2.14.3).", "laravel/tinker": "Required to use the tinker console command (^2.0).", @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-05-07T13:41:51+00:00" + "time": "2024-05-21T17:57:45+00:00" }, { "name": "laravel/octane", @@ -4200,16 +4200,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.21", + "version": "v0.1.22", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "23ea808e8a145653e0ab29e30d4385e49f40a920" + "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/23ea808e8a145653e0ab29e30d4385e49f40a920", - "reference": "23ea808e8a145653e0ab29e30d4385e49f40a920", + "url": "https://api.github.com/repos/laravel/prompts/zipball/37f94de71758dbfbccc9d299b0e5eb76e02a40f5", + "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.21" + "source": "https://github.com/laravel/prompts/tree/v0.1.22" }, - "time": "2024-04-30T12:46:16+00:00" + "time": "2024-05-10T19:22:18+00:00" }, { "name": "laravel/sanctum", From 16414eef077b05a794aa42b9f90a2f6267412e40 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 22 May 2024 10:17:15 -0400 Subject: [PATCH 26/54] refact: shopify user key --- .../Shopify/Workflows/Activities/CreateUserActivity.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php b/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php index da4763e62..12e11e019 100644 --- a/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php +++ b/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php @@ -52,7 +52,8 @@ public function execute(Users $user, Apps $app, array $params): array ]; $customer = $client->Customer->post($customer); - $user->set(CustomFieldEnum::USER_SHOPIFY_ID->value, $customer['id']); + $shopifyUserKey = CustomFieldEnum::USER_SHOPIFY_ID->value . '-' . $app->getId(); + $user->set($shopifyUserKey, $customer['id']); return [ 'status' => 'success', From ae2078c5980642e04028ea2325dbdc77c1d2eef4 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 12:28:25 -0400 Subject: [PATCH 27/54] add vpa and hpa to laravel scheduler pod --- helm/templates/hpa-laravel-scheduler.yaml | 25 +++++++++++++++++++++++ helm/templates/vpa-laravel-scheduler.yaml | 11 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 helm/templates/hpa-laravel-scheduler.yaml create mode 100644 helm/templates/vpa-laravel-scheduler.yaml diff --git a/helm/templates/hpa-laravel-scheduler.yaml b/helm/templates/hpa-laravel-scheduler.yaml new file mode 100644 index 000000000..0f6e3889a --- /dev/null +++ b/helm/templates/hpa-laravel-scheduler.yaml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{.Values.deployments.laravelScheduler.name}} + namespace: {{.Values.namespace}} +spec: + maxReplicas: 15 + minReplicas: 2 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{.Values.deployments.laravelScheduler.name}} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 95 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 95 diff --git a/helm/templates/vpa-laravel-scheduler.yaml b/helm/templates/vpa-laravel-scheduler.yaml new file mode 100644 index 000000000..3178ce1e1 --- /dev/null +++ b/helm/templates/vpa-laravel-scheduler.yaml @@ -0,0 +1,11 @@ +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: {{.Values.deployments.laravelScheduler.name}} +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: {{.Values.deployments.laravelScheduler.name}} + updatePolicy: + updateMode: "Auto" \ No newline at end of file From 9b57d7aa7ca65b0e11e92c701c4e4c7a723101ca Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 13:58:39 -0400 Subject: [PATCH 28/54] remove nginx and telemetry from laravel scheduler --- helm/templates/pod-laravel-scheduler.yaml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index ccf2e00fc..ffca7ad55 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -13,8 +13,6 @@ spec: labels: app: {{.Values.deployments.laravelScheduler.name}} type: api - annotations: - instrumentation.opentelemetry.io/inject-java: "true" spec: volumes: - name: envconfigmap @@ -39,26 +37,6 @@ spec: - key: nginx.conf path: nginx.conf containers: - - name: nginx - image: nginx:1.24 - ports: - - containerPort: 80 - protocol: TCP - volumeMounts: - - name: nginx-config - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - - name: config - mountPath: /etc/nginx/conf.d - - name: webroot - mountPath: "/var/www/html" - resources: - requests: - memory: "128M" - cpu: "100m" - limits: - memory: "512M" - cpu: "200m" - name: {{.Values.deployments.laravelScheduler.containerName}} image: {{.Values.apiImage}} imagePullPolicy: Always From 99138336d0ff8ba6ca9b885b77c73e94ed82e2a1 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 14:12:38 -0400 Subject: [PATCH 29/54] comment laravel scheduler --- helm/templates/hpa-laravel-scheduler.yaml | 50 +++---- helm/templates/pod-laravel-scheduler.yaml | 154 +++++++++++----------- helm/templates/vpa-laravel-scheduler.yaml | 22 ++-- 3 files changed, 113 insertions(+), 113 deletions(-) diff --git a/helm/templates/hpa-laravel-scheduler.yaml b/helm/templates/hpa-laravel-scheduler.yaml index 0f6e3889a..22114acce 100644 --- a/helm/templates/hpa-laravel-scheduler.yaml +++ b/helm/templates/hpa-laravel-scheduler.yaml @@ -1,25 +1,25 @@ -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{.Values.deployments.laravelScheduler.name}} - namespace: {{.Values.namespace}} -spec: - maxReplicas: 15 - minReplicas: 2 - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{.Values.deployments.laravelScheduler.name}} - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 95 - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: 95 +# apiVersion: autoscaling/v2 +# kind: HorizontalPodAutoscaler +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# namespace: {{.Values.namespace}} +# spec: +# maxReplicas: 15 +# minReplicas: 2 +# scaleTargetRef: +# apiVersion: apps/v1 +# kind: Deployment +# name: {{.Values.deployments.laravelScheduler.name}} +# metrics: +# - type: Resource +# resource: +# name: cpu +# target: +# type: Utilization +# averageUtilization: 95 +# - type: Resource +# resource: +# name: memory +# target: +# type: Utilization +# averageUtilization: 95 diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index ffca7ad55..66e36e7cf 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -1,77 +1,77 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{.Values.deployments.laravelScheduler.name}} - namespace: {{.Values.namespace}} -spec: - replicas: 1 - selector: - matchLabels: - app: {{.Values.deployments.laravelScheduler.name}} - template: - metadata: - labels: - app: {{.Values.deployments.laravelScheduler.name}} - type: api - spec: - volumes: - - name: envconfigmap - configMap: - name: envconfigmap - items: - - key: kanvasconfigmap - path: .env - defaultMode: 432 - - name: webroot - emptyDir: {} - - name: config - configMap: - name: nginx-php-api - items: - - key: config - path: default.conf - - name: nginx-config - configMap: - name: nginx-config - items: - - key: nginx.conf - path: nginx.conf - containers: - - name: {{.Values.deployments.laravelScheduler.containerName}} - image: {{.Values.apiImage}} - imagePullPolicy: Always - ports: - - containerPort: 8080 - protocol: TCP - volumeMounts: - - name: envconfigmap - mountPath: /app/.env - subPath: .env - - name: webroot - mountPath: "/var/www/html" - resources: - requests: - memory: "256M" - cpu: "300m" - limits: - memory: "600M" - cpu: "800m" - lifecycle: - postStart: - exec: - command: - [ - "/bin/sh", - "-c", - "cp -R /app/. /var/www/html && \ - chmod -R 755 /var/www/html && \ - chmod -R 777 /var/www/html/storage && \ - chmod -R 777 /var/www/html/storage/logs && \ - chmod -R 777 /var/www/html/bootstrap/cache && \ - cd /var/www/html \ - && php artisan lighthouse:cache \ - && php artisan config:cache \ - && php artisan schedule:work" - ] - securityContext: - fsGroup: 65533 +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# namespace: {{.Values.namespace}} +# spec: +# replicas: 1 +# selector: +# matchLabels: +# app: {{.Values.deployments.laravelScheduler.name}} +# template: +# metadata: +# labels: +# app: {{.Values.deployments.laravelScheduler.name}} +# type: api +# spec: +# volumes: +# - name: envconfigmap +# configMap: +# name: envconfigmap +# items: +# - key: kanvasconfigmap +# path: .env +# defaultMode: 432 +# - name: webroot +# emptyDir: {} +# - name: config +# configMap: +# name: nginx-php-api +# items: +# - key: config +# path: default.conf +# - name: nginx-config +# configMap: +# name: nginx-config +# items: +# - key: nginx.conf +# path: nginx.conf +# containers: +# - name: {{.Values.deployments.laravelScheduler.containerName}} +# image: {{.Values.apiImage}} +# imagePullPolicy: Always +# ports: +# - containerPort: 8080 +# protocol: TCP +# volumeMounts: +# - name: envconfigmap +# mountPath: /app/.env +# subPath: .env +# - name: webroot +# mountPath: "/var/www/html" +# resources: +# requests: +# memory: "256M" +# cpu: "300m" +# limits: +# memory: "600M" +# cpu: "800m" +# lifecycle: +# postStart: +# exec: +# command: +# [ +# "/bin/sh", +# "-c", +# "cp -R /app/. /var/www/html && \ +# chmod -R 755 /var/www/html && \ +# chmod -R 777 /var/www/html/storage && \ +# chmod -R 777 /var/www/html/storage/logs && \ +# chmod -R 777 /var/www/html/bootstrap/cache && \ +# cd /var/www/html \ +# && php artisan lighthouse:cache \ +# && php artisan config:cache \ +# && php artisan schedule:work" +# ] +# securityContext: +# fsGroup: 65533 diff --git a/helm/templates/vpa-laravel-scheduler.yaml b/helm/templates/vpa-laravel-scheduler.yaml index 3178ce1e1..b0c06a39c 100644 --- a/helm/templates/vpa-laravel-scheduler.yaml +++ b/helm/templates/vpa-laravel-scheduler.yaml @@ -1,11 +1,11 @@ -apiVersion: autoscaling.k8s.io/v1 -kind: VerticalPodAutoscaler -metadata: - name: {{.Values.deployments.laravelScheduler.name}} -spec: - targetRef: - apiVersion: "apps/v1" - kind: Deployment - name: {{.Values.deployments.laravelScheduler.name}} - updatePolicy: - updateMode: "Auto" \ No newline at end of file +# apiVersion: autoscaling.k8s.io/v1 +# kind: VerticalPodAutoscaler +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# spec: +# targetRef: +# apiVersion: "apps/v1" +# kind: Deployment +# name: {{.Values.deployments.laravelScheduler.name}} +# updatePolicy: +# updateMode: "Auto" \ No newline at end of file From fa5a5b2877e4fa2f9ae3235d91004b40a58bd876 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 14:52:26 -0400 Subject: [PATCH 30/54] readd laravel scheduler --- helm/templates/hpa-laravel-scheduler.yaml | 50 +++---- helm/templates/pod-laravel-scheduler.yaml | 173 ++++++++++++---------- helm/templates/vpa-laravel-scheduler.yaml | 22 +-- 3 files changed, 132 insertions(+), 113 deletions(-) diff --git a/helm/templates/hpa-laravel-scheduler.yaml b/helm/templates/hpa-laravel-scheduler.yaml index 22114acce..40d8d7976 100644 --- a/helm/templates/hpa-laravel-scheduler.yaml +++ b/helm/templates/hpa-laravel-scheduler.yaml @@ -1,25 +1,25 @@ -# apiVersion: autoscaling/v2 -# kind: HorizontalPodAutoscaler -# metadata: -# name: {{.Values.deployments.laravelScheduler.name}} -# namespace: {{.Values.namespace}} -# spec: -# maxReplicas: 15 -# minReplicas: 2 -# scaleTargetRef: -# apiVersion: apps/v1 -# kind: Deployment -# name: {{.Values.deployments.laravelScheduler.name}} -# metrics: -# - type: Resource -# resource: -# name: cpu -# target: -# type: Utilization -# averageUtilization: 95 -# - type: Resource -# resource: -# name: memory -# target: -# type: Utilization -# averageUtilization: 95 +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{.Values.deployments.laravelScheduler.name}} + namespace: {{.Values.namespace}} +spec: + maxReplicas: 5 + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{.Values.deployments.laravelScheduler.name}} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 95 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 95 diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index 66e36e7cf..064ef03e6 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -1,77 +1,96 @@ -# apiVersion: apps/v1 -# kind: Deployment -# metadata: -# name: {{.Values.deployments.laravelScheduler.name}} -# namespace: {{.Values.namespace}} -# spec: -# replicas: 1 -# selector: -# matchLabels: -# app: {{.Values.deployments.laravelScheduler.name}} -# template: -# metadata: -# labels: -# app: {{.Values.deployments.laravelScheduler.name}} -# type: api -# spec: -# volumes: -# - name: envconfigmap -# configMap: -# name: envconfigmap -# items: -# - key: kanvasconfigmap -# path: .env -# defaultMode: 432 -# - name: webroot -# emptyDir: {} -# - name: config -# configMap: -# name: nginx-php-api -# items: -# - key: config -# path: default.conf -# - name: nginx-config -# configMap: -# name: nginx-config -# items: -# - key: nginx.conf -# path: nginx.conf -# containers: -# - name: {{.Values.deployments.laravelScheduler.containerName}} -# image: {{.Values.apiImage}} -# imagePullPolicy: Always -# ports: -# - containerPort: 8080 -# protocol: TCP -# volumeMounts: -# - name: envconfigmap -# mountPath: /app/.env -# subPath: .env -# - name: webroot -# mountPath: "/var/www/html" -# resources: -# requests: -# memory: "256M" -# cpu: "300m" -# limits: -# memory: "600M" -# cpu: "800m" -# lifecycle: -# postStart: -# exec: -# command: -# [ -# "/bin/sh", -# "-c", -# "cp -R /app/. /var/www/html && \ -# chmod -R 755 /var/www/html && \ -# chmod -R 777 /var/www/html/storage && \ -# chmod -R 777 /var/www/html/storage/logs && \ -# chmod -R 777 /var/www/html/bootstrap/cache && \ -# cd /var/www/html \ -# && php artisan lighthouse:cache \ -# && php artisan config:cache \ -# && php artisan schedule:work" -# ] -# securityContext: -# fsGroup: 65533 +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.Values.deployments.laravelScheduler.name}} + namespace: {{.Values.namespace}} +spec: + replicas: 1 + selector: + matchLabels: + app: {{.Values.deployments.laravelScheduler.name}} + template: + metadata: + labels: + app: {{.Values.deployments.laravelScheduler.name}} + type: api + spec: + volumes: + - name: envconfigmap + configMap: + name: envconfigmap + items: + - key: kanvasconfigmap + path: .env + defaultMode: 432 + - name: webroot + emptyDir: {} + - name: config + configMap: + name: nginx-php-api + items: + - key: config + path: default.conf + - name: nginx-config + configMap: + name: nginx-config + items: + - key: nginx.conf + path: nginx.conf + containers: + - name: nginx + image: nginx:1.24 + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - name: nginx-config + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + - name: config + mountPath: /etc/nginx/conf.d + - name: webroot + mountPath: "/var/www/html" + resources: + requests: + memory: "128M" + cpu: "100m" + limits: + memory: "512M" + cpu: "200m" + - name: {{.Values.deployments.laravelScheduler.containerName}} + image: {{.Values.apiImage}} + imagePullPolicy: Always + ports: + - containerPort: 8080 + protocol: TCP + volumeMounts: + - name: envconfigmap + mountPath: /app/.env + subPath: .env + - name: webroot + mountPath: "/var/www/html" + resources: + requests: + memory: "256M" + cpu: "300m" + limits: + memory: "600M" + cpu: "800m" + lifecycle: + postStart: + exec: + command: + [ + "/bin/sh", + "-c", + "cp -R /app/. /var/www/html && \ + chmod -R 755 /var/www/html && \ + chmod -R 777 /var/www/html/storage && \ + chmod -R 777 /var/www/html/storage/logs && \ + chmod -R 777 /var/www/html/bootstrap/cache && \ + cd /var/www/html \ + && php artisan lighthouse:cache \ + && php artisan config:cache" + ] + securityContext: + fsGroup: 65533 diff --git a/helm/templates/vpa-laravel-scheduler.yaml b/helm/templates/vpa-laravel-scheduler.yaml index b0c06a39c..3178ce1e1 100644 --- a/helm/templates/vpa-laravel-scheduler.yaml +++ b/helm/templates/vpa-laravel-scheduler.yaml @@ -1,11 +1,11 @@ -# apiVersion: autoscaling.k8s.io/v1 -# kind: VerticalPodAutoscaler -# metadata: -# name: {{.Values.deployments.laravelScheduler.name}} -# spec: -# targetRef: -# apiVersion: "apps/v1" -# kind: Deployment -# name: {{.Values.deployments.laravelScheduler.name}} -# updatePolicy: -# updateMode: "Auto" \ No newline at end of file +apiVersion: autoscaling.k8s.io/v1 +kind: VerticalPodAutoscaler +metadata: + name: {{.Values.deployments.laravelScheduler.name}} +spec: + targetRef: + apiVersion: "apps/v1" + kind: Deployment + name: {{.Values.deployments.laravelScheduler.name}} + updatePolicy: + updateMode: "Auto" \ No newline at end of file From f436e22be14198dcaa803f73c6e03b71f2da7b73 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 15:18:41 -0400 Subject: [PATCH 31/54] readd schedule:run --- helm/templates/pod-laravel-scheduler.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index 064ef03e6..f53863f7f 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -90,7 +90,8 @@ spec: chmod -R 777 /var/www/html/bootstrap/cache && \ cd /var/www/html \ && php artisan lighthouse:cache \ - && php artisan config:cache" + && php artisan config:cache \ + && php artisan schedule:run" ] securityContext: fsGroup: 65533 From 352e3dcc7f239e2e413a9b48996503779eea6fa7 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 15:29:58 -0400 Subject: [PATCH 32/54] readd schedule:work command --- helm/templates/pod-laravel-scheduler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index f53863f7f..a8ee023e8 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -91,7 +91,7 @@ spec: cd /var/www/html \ && php artisan lighthouse:cache \ && php artisan config:cache \ - && php artisan schedule:run" + && php artisan schedule:work" ] securityContext: fsGroup: 65533 From 4c477bc8accff3f8107347cc57dd3603acb2e2c2 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 16:12:22 -0400 Subject: [PATCH 33/54] sdaedaed --- helm/templates/pod-laravel-scheduler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index a8ee023e8..f53863f7f 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -91,7 +91,7 @@ spec: cd /var/www/html \ && php artisan lighthouse:cache \ && php artisan config:cache \ - && php artisan schedule:work" + && php artisan schedule:run" ] securityContext: fsGroup: 65533 From 9343d18f0ce55da85d51deef3d3671140179e985 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 16:21:58 -0400 Subject: [PATCH 34/54] add cronjob for laravel scheduler --- helm/templates/cronjob-health-checker.yaml | 63 ------ helm/templates/cronjob-laravel-scheduler.yaml | 63 ++++++ helm/templates/hpa-laravel-scheduler.yaml | 50 ++--- helm/templates/pod-laravel-scheduler.yaml | 194 +++++++++--------- helm/templates/vpa-laravel-scheduler.yaml | 22 +- 5 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 helm/templates/cronjob-health-checker.yaml create mode 100644 helm/templates/cronjob-laravel-scheduler.yaml diff --git a/helm/templates/cronjob-health-checker.yaml b/helm/templates/cronjob-health-checker.yaml deleted file mode 100644 index 0b9bc55de..000000000 --- a/helm/templates/cronjob-health-checker.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# apiVersion: batch/v1 -# kind: CronJob -# metadata: -# name: laravel-schedule -# spec: -# successfulJobsHistoryLimit: 0 -# failedJobsHistoryLimit: 0 -# schedule: "* * * * *" -# jobTemplate: -# spec: -# template: -# spec: -# volumes: -# - name: envconfigmap -# configMap: -# name: envconfigmap -# items: -# - key: kanvasconfigmap -# path: .env -# defaultMode: 432 -# - name: webroot -# emptyDir: {} -# - name: phpini -# configMap: -# name: php-ini-config -# items: -# - key: phpini -# path: phpupdate.ini -# containers: -# - name: {{.Values.deployments.api.containerName}} -# image: {{.Values.apiImage}} -# imagePullPolicy: Always -# volumeMounts: -# - name: envconfigmap -# mountPath: /app/.env -# subPath: .env -# - name: phpini -# mountPath: /usr/local/etc/php/conf.d/phpupdate.ini -# subPath: phpupdate.ini -# - name: webroot -# mountPath: "/var/www/html" -# resources: -# requests: -# memory: "512M" -# cpu: "300m" -# limits: -# memory: "1G" -# cpu: "700m" -# command: -# [ -# "/bin/sh", -# "-c", -# "cp -R /app/. /var/www/html && \ -# chmod -R 755 /var/www/html && \ -# chmod -R 777 /var/www/html/storage && \ -# chmod -R 777 /var/www/html/storage/logs && \ -# chmod -R 777 /var/www/html/bootstrap/cache && \ -# cd /var/www/html \ -# && composer install --no-dev --optimize-autoloader \ -# && php artisan config:cache \ -# && php artisan schedule:run" -# ] -# restartPolicy: OnFailure \ No newline at end of file diff --git a/helm/templates/cronjob-laravel-scheduler.yaml b/helm/templates/cronjob-laravel-scheduler.yaml new file mode 100644 index 000000000..31064f740 --- /dev/null +++ b/helm/templates/cronjob-laravel-scheduler.yaml @@ -0,0 +1,63 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: laravel-schedule +spec: + successfulJobsHistoryLimit: 3 + failedJobsHistoryLimit: 0 + schedule: "* * * * *" + jobTemplate: + spec: + template: + spec: + volumes: + - name: envconfigmap + configMap: + name: envconfigmap + items: + - key: kanvasconfigmap + path: .env + defaultMode: 432 + - name: webroot + emptyDir: {} + - name: phpini + configMap: + name: php-ini-config + items: + - key: phpini + path: phpupdate.ini + containers: + - name: {{.Values.deployments.laravelScheduler.containerName}} + image: {{.Values.apiImage}} + imagePullPolicy: Always + volumeMounts: + - name: envconfigmap + mountPath: /app/.env + subPath: .env + - name: phpini + mountPath: /usr/local/etc/php/conf.d/phpupdate.ini + subPath: phpupdate.ini + - name: webroot + mountPath: "/var/www/html" + resources: + requests: + memory: "512M" + cpu: "300m" + limits: + memory: "1G" + cpu: "700m" + command: + [ + "/bin/sh", + "-c", + "cp -R /app/. /var/www/html && \ + chmod -R 755 /var/www/html && \ + chmod -R 777 /var/www/html/storage && \ + chmod -R 777 /var/www/html/storage/logs && \ + chmod -R 777 /var/www/html/bootstrap/cache && \ + cd /var/www/html \ + && composer install --no-dev --optimize-autoloader \ + && php artisan config:cache \ + && php artisan schedule:run" + ] + restartPolicy: OnFailure \ No newline at end of file diff --git a/helm/templates/hpa-laravel-scheduler.yaml b/helm/templates/hpa-laravel-scheduler.yaml index 40d8d7976..a30894d5b 100644 --- a/helm/templates/hpa-laravel-scheduler.yaml +++ b/helm/templates/hpa-laravel-scheduler.yaml @@ -1,25 +1,25 @@ -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{.Values.deployments.laravelScheduler.name}} - namespace: {{.Values.namespace}} -spec: - maxReplicas: 5 - minReplicas: 1 - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{.Values.deployments.laravelScheduler.name}} - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 95 - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: 95 +# apiVersion: autoscaling/v2 +# kind: HorizontalPodAutoscaler +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# namespace: {{.Values.namespace}} +# spec: +# maxReplicas: 5 +# minReplicas: 1 +# scaleTargetRef: +# apiVersion: apps/v1 +# kind: Deployment +# name: {{.Values.deployments.laravelScheduler.name}} +# metrics: +# - type: Resource +# resource: +# name: cpu +# target: +# type: Utilization +# averageUtilization: 95 +# - type: Resource +# resource: +# name: memory +# target: +# type: Utilization +# averageUtilization: 95 diff --git a/helm/templates/pod-laravel-scheduler.yaml b/helm/templates/pod-laravel-scheduler.yaml index f53863f7f..7326a8b2a 100644 --- a/helm/templates/pod-laravel-scheduler.yaml +++ b/helm/templates/pod-laravel-scheduler.yaml @@ -1,97 +1,97 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{.Values.deployments.laravelScheduler.name}} - namespace: {{.Values.namespace}} -spec: - replicas: 1 - selector: - matchLabels: - app: {{.Values.deployments.laravelScheduler.name}} - template: - metadata: - labels: - app: {{.Values.deployments.laravelScheduler.name}} - type: api - spec: - volumes: - - name: envconfigmap - configMap: - name: envconfigmap - items: - - key: kanvasconfigmap - path: .env - defaultMode: 432 - - name: webroot - emptyDir: {} - - name: config - configMap: - name: nginx-php-api - items: - - key: config - path: default.conf - - name: nginx-config - configMap: - name: nginx-config - items: - - key: nginx.conf - path: nginx.conf - containers: - - name: nginx - image: nginx:1.24 - ports: - - containerPort: 80 - protocol: TCP - volumeMounts: - - name: nginx-config - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - - name: config - mountPath: /etc/nginx/conf.d - - name: webroot - mountPath: "/var/www/html" - resources: - requests: - memory: "128M" - cpu: "100m" - limits: - memory: "512M" - cpu: "200m" - - name: {{.Values.deployments.laravelScheduler.containerName}} - image: {{.Values.apiImage}} - imagePullPolicy: Always - ports: - - containerPort: 8080 - protocol: TCP - volumeMounts: - - name: envconfigmap - mountPath: /app/.env - subPath: .env - - name: webroot - mountPath: "/var/www/html" - resources: - requests: - memory: "256M" - cpu: "300m" - limits: - memory: "600M" - cpu: "800m" - lifecycle: - postStart: - exec: - command: - [ - "/bin/sh", - "-c", - "cp -R /app/. /var/www/html && \ - chmod -R 755 /var/www/html && \ - chmod -R 777 /var/www/html/storage && \ - chmod -R 777 /var/www/html/storage/logs && \ - chmod -R 777 /var/www/html/bootstrap/cache && \ - cd /var/www/html \ - && php artisan lighthouse:cache \ - && php artisan config:cache \ - && php artisan schedule:run" - ] - securityContext: - fsGroup: 65533 +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# namespace: {{.Values.namespace}} +# spec: +# replicas: 1 +# selector: +# matchLabels: +# app: {{.Values.deployments.laravelScheduler.name}} +# template: +# metadata: +# labels: +# app: {{.Values.deployments.laravelScheduler.name}} +# type: api +# spec: +# volumes: +# - name: envconfigmap +# configMap: +# name: envconfigmap +# items: +# - key: kanvasconfigmap +# path: .env +# defaultMode: 432 +# - name: webroot +# emptyDir: {} +# - name: config +# configMap: +# name: nginx-php-api +# items: +# - key: config +# path: default.conf +# - name: nginx-config +# configMap: +# name: nginx-config +# items: +# - key: nginx.conf +# path: nginx.conf +# containers: +# - name: nginx +# image: nginx:1.24 +# ports: +# - containerPort: 80 +# protocol: TCP +# volumeMounts: +# - name: nginx-config +# mountPath: /etc/nginx/nginx.conf +# subPath: nginx.conf +# - name: config +# mountPath: /etc/nginx/conf.d +# - name: webroot +# mountPath: "/var/www/html" +# resources: +# requests: +# memory: "128M" +# cpu: "100m" +# limits: +# memory: "512M" +# cpu: "200m" +# - name: {{.Values.deployments.laravelScheduler.containerName}} +# image: {{.Values.apiImage}} +# imagePullPolicy: Always +# ports: +# - containerPort: 8080 +# protocol: TCP +# volumeMounts: +# - name: envconfigmap +# mountPath: /app/.env +# subPath: .env +# - name: webroot +# mountPath: "/var/www/html" +# resources: +# requests: +# memory: "256M" +# cpu: "300m" +# limits: +# memory: "600M" +# cpu: "800m" +# lifecycle: +# postStart: +# exec: +# command: +# [ +# "/bin/sh", +# "-c", +# "cp -R /app/. /var/www/html && \ +# chmod -R 755 /var/www/html && \ +# chmod -R 777 /var/www/html/storage && \ +# chmod -R 777 /var/www/html/storage/logs && \ +# chmod -R 777 /var/www/html/bootstrap/cache && \ +# cd /var/www/html \ +# && php artisan lighthouse:cache \ +# && php artisan config:cache \ +# && php artisan schedule:run" +# ] +# securityContext: +# fsGroup: 65533 diff --git a/helm/templates/vpa-laravel-scheduler.yaml b/helm/templates/vpa-laravel-scheduler.yaml index 3178ce1e1..b0c06a39c 100644 --- a/helm/templates/vpa-laravel-scheduler.yaml +++ b/helm/templates/vpa-laravel-scheduler.yaml @@ -1,11 +1,11 @@ -apiVersion: autoscaling.k8s.io/v1 -kind: VerticalPodAutoscaler -metadata: - name: {{.Values.deployments.laravelScheduler.name}} -spec: - targetRef: - apiVersion: "apps/v1" - kind: Deployment - name: {{.Values.deployments.laravelScheduler.name}} - updatePolicy: - updateMode: "Auto" \ No newline at end of file +# apiVersion: autoscaling.k8s.io/v1 +# kind: VerticalPodAutoscaler +# metadata: +# name: {{.Values.deployments.laravelScheduler.name}} +# spec: +# targetRef: +# apiVersion: "apps/v1" +# kind: Deployment +# name: {{.Values.deployments.laravelScheduler.name}} +# updatePolicy: +# updateMode: "Auto" \ No newline at end of file From d37bb5f88e6ddf2d80719e515d305be665cb16df Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 22 May 2024 16:44:32 -0400 Subject: [PATCH 35/54] turn success history to 0 --- helm/templates/cronjob-laravel-scheduler.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/templates/cronjob-laravel-scheduler.yaml b/helm/templates/cronjob-laravel-scheduler.yaml index 31064f740..b31423386 100644 --- a/helm/templates/cronjob-laravel-scheduler.yaml +++ b/helm/templates/cronjob-laravel-scheduler.yaml @@ -3,7 +3,7 @@ kind: CronJob metadata: name: laravel-schedule spec: - successfulJobsHistoryLimit: 3 + successfulJobsHistoryLimit: 0 failedJobsHistoryLimit: 0 schedule: "* * * * *" jobTemplate: From 4b8bb62c0540a0e283baace26ebe4ab7cea3d217 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 22:11:00 +0000 Subject: [PATCH 36/54] build(deps): bump league/flysystem-aws-s3-v3 from 3.27.0 to 3.28.0 Bumps [league/flysystem-aws-s3-v3](https://github.com/thephpleague/flysystem-aws-s3-v3) from 3.27.0 to 3.28.0. - [Commits](https://github.com/thephpleague/flysystem-aws-s3-v3/compare/3.27.0...3.28.0) --- updated-dependencies: - dependency-name: league/flysystem-aws-s3-v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 81 +++++++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/composer.lock b/composer.lock index 309ffc94e..f0caf34f3 100644 --- a/composer.lock +++ b/composer.lock @@ -1195,16 +1195,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.306.3", + "version": "3.308.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "d340c5e7fc151d59f71e8c3bf7c5eafa911bcebd" + "reference": "bf5f1221d4c5c67d3213150fb91dfb5ce627227b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d340c5e7fc151d59f71e8c3bf7c5eafa911bcebd", - "reference": "d340c5e7fc151d59f71e8c3bf7c5eafa911bcebd", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bf5f1221d4c5c67d3213150fb91dfb5ce627227b", + "reference": "bf5f1221d4c5c67d3213150fb91dfb5ce627227b", "shasum": "" }, "require": { @@ -1284,9 +1284,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.306.3" + "source": "https://github.com/aws/aws-sdk-php/tree/3.308.1" }, - "time": "2024-05-09T18:32:58+00:00" + "time": "2024-05-22T18:05:56+00:00" }, { "name": "berkayk/onesignal-laravel", @@ -4948,16 +4948,16 @@ }, { "name": "league/flysystem", - "version": "3.27.0", + "version": "3.28.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "4729745b1ab737908c7d055148c9a6b3e959832f" + "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4729745b1ab737908c7d055148c9a6b3e959832f", - "reference": "4729745b1ab737908c7d055148c9a6b3e959832f", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", + "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", "shasum": "" }, "require": { @@ -4981,10 +4981,13 @@ "composer/semver": "^3.0", "ext-fileinfo": "*", "ext-ftp": "*", + "ext-mongodb": "^1.3", "ext-zip": "*", "friendsofphp/php-cs-fixer": "^3.5", "google/cloud-storage": "^1.23", + "guzzlehttp/psr7": "^2.6", "microsoft/azure-storage-blob": "^1.1", + "mongodb/mongodb": "^1.2", "phpseclib/phpseclib": "^3.0.36", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.5.11|^10.0", @@ -5022,32 +5025,22 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.27.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.28.0" }, - "funding": [ - { - "url": "https://ecologi.com/frankdejonge", - "type": "custom" - }, - { - "url": "https://github.com/frankdejonge", - "type": "github" - } - ], - "time": "2024-04-07T19:17:50+00:00" + "time": "2024-05-22T10:09:12+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "3.27.0", + "version": "3.28.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "3e6ce2f972f1470db779f04d29c289dcd2c32837" + "reference": "22071ef1604bc776f5ff2468ac27a752514665c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/3e6ce2f972f1470db779f04d29c289dcd2c32837", - "reference": "3e6ce2f972f1470db779f04d29c289dcd2c32837", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/22071ef1604bc776f5ff2468ac27a752514665c8", + "reference": "22071ef1604bc776f5ff2468ac27a752514665c8", "shasum": "" }, "require": { @@ -5087,19 +5080,9 @@ "storage" ], "support": { - "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.27.0" + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.28.0" }, - "funding": [ - { - "url": "https://ecologi.com/frankdejonge", - "type": "custom" - }, - { - "url": "https://github.com/frankdejonge", - "type": "github" - } - ], - "time": "2024-04-07T19:16:54+00:00" + "time": "2024-05-06T20:05:52+00:00" }, { "name": "league/flysystem-google-cloud-storage", @@ -5161,16 +5144,16 @@ }, { "name": "league/flysystem-local", - "version": "3.25.1", + "version": "3.28.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "61a6a90d6e999e4ddd9ce5adb356de0939060b92" + "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/61a6a90d6e999e4ddd9ce5adb356de0939060b92", - "reference": "61a6a90d6e999e4ddd9ce5adb356de0939060b92", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/13f22ea8be526ea58c2ddff9e158ef7c296e4f40", + "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40", "shasum": "" }, "require": { @@ -5204,19 +5187,9 @@ "local" ], "support": { - "source": "https://github.com/thephpleague/flysystem-local/tree/3.25.1" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.28.0" }, - "funding": [ - { - "url": "https://ecologi.com/frankdejonge", - "type": "custom" - }, - { - "url": "https://github.com/frankdejonge", - "type": "github" - } - ], - "time": "2024-03-15T19:58:44+00:00" + "time": "2024-05-06T20:05:52+00:00" }, { "name": "league/mime-type-detection", From d60e7e940aa7c52513dce7d4772aabe61f054965 Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 22 May 2024 23:23:33 -0400 Subject: [PATCH 37/54] Update array of warehouses on variants --- graphql/schemas/Inventory/variant.graphql | 2 +- graphql/schemas/Inventory/variantWarehouse.graphql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index a0dd4d443..928c42041 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -89,7 +89,7 @@ input VariantsUpdateInput { attributes: [VariantsAttributesInput!] serial_number: String is_published: Boolean - warehouse: VariantsWarehousesInput + warehouses: [VariantsWarehousesInput!] } extend type Mutation @guard { diff --git a/graphql/schemas/Inventory/variantWarehouse.graphql b/graphql/schemas/Inventory/variantWarehouse.graphql index 01d9c49f4..77b1d33c2 100644 --- a/graphql/schemas/Inventory/variantWarehouse.graphql +++ b/graphql/schemas/Inventory/variantWarehouse.graphql @@ -29,7 +29,7 @@ type WarehouseVariantRelationship { input VariantsWarehousesInput { warehouse_id: ID! - quantity: Float + quantity: Int status: StatusReferenceInput price: Float sku: String From de76ae1512d84397f6e894697a5fd84f6f686710 Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 22 May 2024 23:32:03 -0400 Subject: [PATCH 38/54] Create services for warehouses --- .../Warehouses/Services/WarehouseService.php | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/Domains/Inventory/Warehouses/Services/WarehouseService.php diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php new file mode 100644 index 000000000..52e70ed9b --- /dev/null +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -0,0 +1,107 @@ +variantWarehouses->keyBy('warehouses_id'); + $existedWarehouses = $existedWarehouses->keys()->all(); + $toDelete = array_diff($existedWarehouses, $warehousesId); + + foreach($warehouses as $warehouseData) { + + $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $user->getCurrentCompany()); + + if (isset($warehouseData['status'])) { + $warehouseData['status_id'] = StatusRepository::getById( + (int) $warehouseData['status']['id'], + $variant->product->company()->get()->first() + )->getId(); + } else { + $warehouseData['status_id'] = Status::getDefault($user->getCurrentCompany())->getId(); + } + + $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouseModel, $warehouseData); + + (new UpdateToWarehouseAction( + $variantWarehousesDto + ))->execute(); + } + + if (!empty($toDelete)) { + + $toDelete = $variant->variantWarehouses + ->whereIn('warehouses_id', $toDelete) + ->map(function ($variantWarehouse) use ($user){ + WarehouseService::removeVariantWarehouses( + $variantWarehouse->variant, + $variantWarehouse->warehouse, + $user + ); + }); + } + + return $variant; + } + + public static function addToWarehouses( + Variants $variant, + Warehouses $warehouse, + Companies $company, + array $warehousesInfo + ): ModelsVariantsWarehouses { + if (isset($warehousesInfo['status'])) { + $status = StatusRepository::getById( + (int) $warehousesInfo['status']['id'], + $company + )->getId(); + } else { + $status = Status::getDefault($company); + } + + $warehousesInfo['status_id'] = $status ? $status->getId() : null; + $variantWarehouses = VariantsWarehouses::viaRequest($variant, $warehouse, $warehousesInfo ?? []); + + if ($variant->sku && (! isset($warehousesInfo['sku']) || ! $warehousesInfo['sku'])) { + $warehousesInfo['sku'] = $variant->sku; + } + return (new AddToWarehouse($variant, $warehouse, $variantWarehouses))->execute(); + } + + public static function removeVariantWarehouses( + Variants $variant, + Warehouses $warehouse, + UserInterface $user, + ): Variants { + CompaniesRepository::userAssociatedToCompany( + $variant->company, + $user + ); + $variantWarehouse = $variant->variantWarehouses('warehouses_id', $warehouse->getId()); + $variantWarehouse->first()->delete(); + + return $variant; + } +} From 2d15da73b16366ac5cfb6c8a2aa2cee174ed173f Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 22 May 2024 23:32:30 -0400 Subject: [PATCH 39/54] Move method to warehouses service --- .../Variants/Services/VariantService.php | 40 ++++--------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 82458c02c..b5ab124b1 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -5,7 +5,6 @@ namespace Kanvas\Inventory\Variants\Services; use Baka\Users\Contracts\UserInterface; -use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Products\DataTransferObject\Product as ProductDto; use Kanvas\Inventory\Products\Models\Products; @@ -24,6 +23,7 @@ use Kanvas\Inventory\Variants\Models\VariantsWarehouses as ModelsVariantsWarehouses; use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Inventory\Warehouses\Repositories\WarehouseRepository; +use Kanvas\Inventory\Warehouses\Services\WarehouseService; class VariantService { @@ -69,7 +69,7 @@ public static function createVariantsFromArray(Products $product, array $variant if (isset($variant['warehouses'])) { foreach ($variant['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); - VariantService::addToWarehouses( + WarehouseService::addToWarehouses( $variantModel, $warehouse, $company, @@ -78,7 +78,7 @@ public static function createVariantsFromArray(Products $product, array $variant } } else { $warehouse = Warehouses::getDefault($company); - VariantService::addToWarehouses( + WarehouseService::addToWarehouses( $variantModel, $warehouse, $company, @@ -122,7 +122,7 @@ public static function createDefaultVariant(Products $product, UserInterface $us } else { $variant['warehouse']['status_id'] = Status::getDefault($company)->getId(); } - $variantWarehouses = VariantsWarehouses::viaRequest($variant['warehouse'] ?? []); + $variantWarehouses = VariantsWarehouses::viaRequest($variantModel, $warehouse, $variant['warehouse'] ?? []); (new AddToWarehouse($variantModel, $warehouse, $variantWarehouses))->execute(); @@ -139,16 +139,14 @@ public static function updateWarehouseVariant(Variants $variant, Warehouses $war (int) $data['status']['id'], $variant->product->company()->get()->first() )->getId(); + }else { + $data['status_id'] = Status::getDefault($variant->product->company()->get()->first())->getId(); } - $variantWarehousesDto = VariantsWarehouses::viaRequest($data); - $variantWarehouses = ModelsVariantsWarehouses::where('products_variants_id', $variant->getId()) - ->where('warehouses_id', $warehouse->getId()) - ->firstOrFail(); + $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouse, $data); return ( new UpdateToWarehouseAction( - $variantWarehouses, $variantWarehousesDto ))->execute(); } @@ -187,28 +185,4 @@ public static function addVariantChannel( $variantChannelDto ))->execute(); } - - public static function addToWarehouses( - Variants $variant, - Warehouses $warehouse, - Companies $company, - array $warehousesInfo - ): ModelsVariantsWarehouses { - if (isset($warehousesInfo['status'])) { - $status = StatusRepository::getById( - (int) $warehousesInfo['status']['id'], - $company - )->getId(); - } else { - $status = Status::getDefault($company); - } - - $warehousesInfo['status_id'] = $status ? $status->getId() : null; - $variantWarehouses = VariantsWarehouses::viaRequest($warehousesInfo ?? []); - - if ($variant->sku && (! isset($warehousesInfo['sku']) || ! $warehousesInfo['sku'])) { - $warehousesInfo['sku'] = $variant->sku; - } - return (new AddToWarehouse($variant, $warehouse, $variantWarehouses))->execute(); - } } From f6e37ee72233b2c8e8efe28258e560860655270b Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 22 May 2024 23:52:13 -0400 Subject: [PATCH 40/54] user warehouses service for methods --- .../Inventory/Mutations/Variants/Variants.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 16714e6e9..77306c1f2 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -22,6 +22,7 @@ use Kanvas\Inventory\Variants\Services\VariantService; use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Inventory\Warehouses\Repositories\WarehouseRepository; +use Kanvas\Inventory\Warehouses\Services\WarehouseService; class Variants { @@ -50,7 +51,7 @@ public function create(mixed $root, array $req): VariantModel foreach ($req['input']['warehouses'] as $warehouseData) { $warehouse = WarehouseRepository::getById((int) $warehouseData['id'], $company); - VariantService::addToWarehouses( + WarehouseService::addToWarehouses( $variantModel, $warehouse, $company, @@ -60,7 +61,7 @@ public function create(mixed $root, array $req): VariantModel } else { $warehouse = Warehouses::getDefault($company); - VariantService::addToWarehouses( + WarehouseService::addToWarehouses( $variantModel, $warehouse, $company, @@ -108,9 +109,8 @@ public function update(mixed $root, array $req): VariantModel $variant->addAttributes(auth()->user(), $req['input']['attributes']); } - if (isset($req['input']['warehouse'])) { - $warehouse = WarehouseRepository::getById((int) $req['input']['warehouse']['warehouse_id'], $company); - VariantService::updateWarehouseVariant($variant, $warehouse, $req['input']['warehouse']); + if (isset($req['input']['warehouses'])) { + WarehouseService::updateWarehouseVariant($variant, auth()->user(), $req['input']['warehouses']); } return $variant; @@ -138,7 +138,7 @@ public function addToWarehouse(mixed $root, array $req): VariantModel if (isset($req['input']['status'])) { $req['input']['status_id'] = StatusRepository::getById((int) $req['input']['status']['id'], $company)->getId(); } - $variantWarehouses = VariantsWarehouses::viaRequest($req['input']); + $variantWarehouses = VariantsWarehouses::viaRequest($variant, $warehouse, $req['input']); (new AddToWarehouse($variant, $warehouse, $variantWarehouses))->execute(); @@ -159,7 +159,6 @@ public function updateVariantInWarehouse(mixed $root, array $req): VariantModel } /** - * @todo Remove and use softdelete. * removeToWarehouse. */ public function removeToWarehouse(mixed $root, array $req): VariantModel @@ -167,9 +166,9 @@ public function removeToWarehouse(mixed $root, array $req): VariantModel $company = auth()->user()->getCurrentCompany(); $variant = VariantsRepository::getById((int) $req['id'], $company); - $warehouse = WarehouseRepository::getById($req['warehouse_id'], $company); - $variant->warehouses()->detach($warehouse); + + WarehouseService::removeVariantWarehouses($variant,$warehouse, auth()->user()); return $variant; } From 10e564df4c9c99ba9d4c702a982dff384e275369 Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 22 May 2024 23:52:53 -0400 Subject: [PATCH 41/54] update variant warehouses dto optional fields --- .../DataTransferObject/VariantsWarehouses.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php b/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php index b55a61ad5..99563928c 100644 --- a/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php +++ b/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php @@ -4,14 +4,18 @@ namespace Kanvas\Inventory\Variants\DataTransferObject; +use Kanvas\Inventory\Variants\Models\Variants; +use Kanvas\Inventory\Warehouses\Models\Warehouses; use Spatie\LaravelData\Data; class VariantsWarehouses extends Data { public function __construct( - public ?float $quantity = null, - public ?float $price = null, - public ?string $sku = null, + public Variants $variant, + public Warehouses $warehouse, + public ?float $quantity = 0, + public float $price = 0.00, + public string $sku, public int $position = 0, public ?string $serial_number = null, public ?int $status_id = null, @@ -26,12 +30,14 @@ public function __construct( ) { } - public static function viaRequest(array $request): self + public static function viaRequest(Variants $variant, Warehouses $warehouse, array $request): self { return new self( - $request['quantity'] ?? null, - $request['price'] ?? null, - $request['sku'] ?? null, + $variant, + $warehouse, + isset($request['quantity']) ? $request['quantity'] : 0, + isset($request['price']) ? $request['price'] : 0.00, + $request['sku'] ?? $variant->sku, $request['position'] ?? 0, $request['serial_number'] ?? null, $request['status_id'] ?? null, From f1e53a2c3a4e1d4a273a5ecab5a60e82d590b33b Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 02:12:44 -0400 Subject: [PATCH 42/54] use updateOrCreate on variantWarehouses update --- .../Actions/UpdateToWarehouseAction.php | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php b/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php index d9b16c5e7..f43110669 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php @@ -4,9 +4,11 @@ namespace Kanvas\Inventory\Variants\Actions; +use App\GraphQL\Inventory\Mutations\Warehouses\Warehouse; use Kanvas\Inventory\Variants\DataTransferObject\VariantsWarehouses as VariantsWarehousesDto; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; +use Kanvas\Inventory\Warehouses\Models\Warehouses; class UpdateToWarehouseAction { @@ -16,7 +18,6 @@ class UpdateToWarehouseAction * @return void */ public function __construct( - public VariantsWarehouses $variantsWarehouses, public VariantsWarehousesDto $variantsWarehousesDto, ) { } @@ -27,28 +28,31 @@ public function __construct( */ public function execute(): Variants { - $oldStatusId = $this->variantsWarehouses->status_id; - $oldPrice = $this->variantsWarehouses->price; + $search = [ + 'products_variants_id' => $this->variantsWarehousesDto->variant->getId(), + 'warehouses_id' => $this->variantsWarehousesDto->warehouse->getId() + ]; - $this->variantsWarehouses->update( + $variantWarehouse = VariantsWarehouses::updateOrCreate( + $search, [ - 'quantity' => $this->variantsWarehousesDto->quantity ?? $this->variantsWarehouses->quantity, - 'price' => $this->variantsWarehousesDto->price ?? $this->variantsWarehouses->price, - 'sku' => $this->variantsWarehousesDto->sku ?? $this->variantsWarehouses->sku, - 'position' => $this->variantsWarehousesDto->position ?? $this->variantsWarehouses->position, - 'serial_number' => $this->variantsWarehousesDto->serial_number ?? $this->variantsWarehouses->serial_number, - 'status_id' => $this->variantsWarehousesDto->status_id ?? $this->variantsWarehouses->status_id, - 'is_oversellable' => $this->variantsWarehousesDto->is_oversellable ?? $this->variantsWarehouses->is_oversellable, + 'quantity' => $this->variantsWarehousesDto->quantity, + 'price' => $this->variantsWarehousesDto->price, + 'sku' => $this->variantsWarehousesDto->sku, + 'position' => $this->variantsWarehousesDto->position, + 'serial_number' => $this->variantsWarehousesDto->serial_number, + 'status_id' => $this->variantsWarehousesDto->status_id, + 'is_oversellable' => $this->variantsWarehousesDto->is_oversellable, 'is_default' => $this->variantsWarehousesDto->is_default ?? $this->variantsWarehouses->is_default, - 'is_best_seller' => $this->variantsWarehousesDto->is_best_seller ?? $this->variantsWarehouses->is_best_seller, - 'is_on_sale' => $this->variantsWarehousesDto->is_on_sale ?? $this->variantsWarehouses->is_on_sale, - 'is_on_promo' => $this->variantsWarehousesDto->is_on_promo ?? $this->variantsWarehouses->is_on_promo, - 'can_pre_order' => $this->variantsWarehousesDto->can_pre_order ?? $this->variantsWarehouses->can_pre_order, - 'is_coming_son' => $this->variantsWarehousesDto->is_coming_son ?? $this->variantsWarehouses->is_coming_son, - 'is_new' => $this->variantsWarehousesDto->is_new ?? $this->variantsWarehouses->is_new, + 'is_best_seller' => $this->variantsWarehousesDto->is_best_seller, + 'is_on_sale' => $this->variantsWarehousesDto->is_on_sale, + 'is_on_promo' => $this->variantsWarehousesDto->is_on_promo, + 'can_pre_order' => $this->variantsWarehousesDto->can_pre_order, + 'is_coming_son' => $this->variantsWarehousesDto->is_coming_son, + 'is_new' => $this->variantsWarehousesDto->is_new, ] ); - return $this->variantsWarehouses->variant; + return $variantWarehouse->variant; } } From e69e7176e1233eabfd38b70142df1d64749a816a Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 02:13:06 -0400 Subject: [PATCH 43/54] spacing --- app/Console/Commands/KanvasInventoryDefaultUpdate.php | 2 ++ tests/GraphQL/Inventory/ProductsTest.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/Console/Commands/KanvasInventoryDefaultUpdate.php b/app/Console/Commands/KanvasInventoryDefaultUpdate.php index 59d8d4c10..c26494e90 100644 --- a/app/Console/Commands/KanvasInventoryDefaultUpdate.php +++ b/app/Console/Commands/KanvasInventoryDefaultUpdate.php @@ -138,6 +138,8 @@ public function handle() foreach ($variants as $variant) { $this->info("Working variant {$variant->getId()} warehouse assignment \n"); $variantWarehouseDto = DataTransferObjectVariantsWarehouses::viaRequest( + $variant, + $defaultWarehouses, [ 'status_id' => $defaultStatus->getId() ] diff --git a/tests/GraphQL/Inventory/ProductsTest.php b/tests/GraphQL/Inventory/ProductsTest.php index c232b36ae..4057c5400 100644 --- a/tests/GraphQL/Inventory/ProductsTest.php +++ b/tests/GraphQL/Inventory/ProductsTest.php @@ -296,6 +296,7 @@ public function testAddVariantToProduct(): void products_id } }', ['data' => $data]); + $this->assertArrayHasKey('id', $variantResponse->json()['data']['createVariant']); } From f567d06cb214f816522d7cf4b79ee800fb3c2813 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 02:16:09 -0400 Subject: [PATCH 44/54] stylo --- .../Inventory/Mutations/Variants/Variants.php | 2 +- .../Inventory/Variants/Services/VariantService.php | 2 +- .../Warehouses/Services/WarehouseService.php | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 77306c1f2..6f29fd3c6 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -168,7 +168,7 @@ public function removeToWarehouse(mixed $root, array $req): VariantModel $variant = VariantsRepository::getById((int) $req['id'], $company); $warehouse = WarehouseRepository::getById($req['warehouse_id'], $company); - WarehouseService::removeVariantWarehouses($variant,$warehouse, auth()->user()); + WarehouseService::removeVariantWarehouses($variant, $warehouse, auth()->user()); return $variant; } diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index b5ab124b1..5aeba1f1c 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -139,7 +139,7 @@ public static function updateWarehouseVariant(Variants $variant, Warehouses $war (int) $data['status']['id'], $variant->product->company()->get()->first() )->getId(); - }else { + } else { $data['status_id'] = Status::getDefault($variant->product->company()->get()->first())->getId(); } diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php index 52e70ed9b..344c4f421 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -24,14 +24,13 @@ class WarehouseService */ public static function updateWarehouseVariant(Variants $variant, UserInterface $user, array $warehouses): Variants { - $warehousesId = array_column($warehouses,'warehouse_id'); + $warehousesId = array_column($warehouses, 'warehouse_id'); $existedWarehouses = $variant->variantWarehouses->keyBy('warehouses_id'); $existedWarehouses = $existedWarehouses->keys()->all(); $toDelete = array_diff($existedWarehouses, $warehousesId); - foreach($warehouses as $warehouseData) { - + foreach ($warehouses as $warehouseData) { $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $user->getCurrentCompany()); if (isset($warehouseData['status'])) { @@ -46,15 +45,14 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouseModel, $warehouseData); (new UpdateToWarehouseAction( - $variantWarehousesDto + $variantWarehousesDto ))->execute(); } - if (!empty($toDelete)) { - + if (! empty($toDelete)) { $toDelete = $variant->variantWarehouses ->whereIn('warehouses_id', $toDelete) - ->map(function ($variantWarehouse) use ($user){ + ->map(function ($variantWarehouse) use ($user) { WarehouseService::removeVariantWarehouses( $variantWarehouse->variant, $variantWarehouse->warehouse, From f0ab6db1797776e6d4839376ba09d9a1649736f8 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 02:20:46 -0400 Subject: [PATCH 45/54] mapper --- .../Variants/DataTransferObject/VariantsWarehouses.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php b/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php index 99563928c..f1ceb8aa4 100644 --- a/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php +++ b/src/Domains/Inventory/Variants/DataTransferObject/VariantsWarehouses.php @@ -13,8 +13,8 @@ class VariantsWarehouses extends Data public function __construct( public Variants $variant, public Warehouses $warehouse, - public ?float $quantity = 0, - public float $price = 0.00, + public float $quantity, + public float $price, public string $sku, public int $position = 0, public ?string $serial_number = null, From 6f6fb75c087c160b5c1f98c06e168d32ef433027 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 02:26:31 -0400 Subject: [PATCH 46/54] action fix --- .../Inventory/Variants/Actions/UpdateToWarehouseAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php b/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php index f43110669..73e648cba 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateToWarehouseAction.php @@ -43,7 +43,7 @@ public function execute(): Variants 'serial_number' => $this->variantsWarehousesDto->serial_number, 'status_id' => $this->variantsWarehousesDto->status_id, 'is_oversellable' => $this->variantsWarehousesDto->is_oversellable, - 'is_default' => $this->variantsWarehousesDto->is_default ?? $this->variantsWarehouses->is_default, + 'is_default' => $this->variantsWarehousesDto->is_default ?? $this->variantsWarehousesDto->is_default, 'is_best_seller' => $this->variantsWarehousesDto->is_best_seller, 'is_on_sale' => $this->variantsWarehousesDto->is_on_sale, 'is_on_promo' => $this->variantsWarehousesDto->is_on_promo, From 9dd3ab317e53597e3236e4f090cd6e88a36df2ef Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 11:57:53 -0400 Subject: [PATCH 47/54] remove user current company --- .../Inventory/Warehouses/Services/WarehouseService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php index 344c4f421..2f40bbbc7 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -31,7 +31,7 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $toDelete = array_diff($existedWarehouses, $warehousesId); foreach ($warehouses as $warehouseData) { - $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $user->getCurrentCompany()); + $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $variant->product->company()->get()->first()); if (isset($warehouseData['status'])) { $warehouseData['status_id'] = StatusRepository::getById( @@ -39,7 +39,7 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $variant->product->company()->get()->first() )->getId(); } else { - $warehouseData['status_id'] = Status::getDefault($user->getCurrentCompany())->getId(); + $warehouseData['status_id'] = Status::getDefault($variant->product->company()->get()->first())->getId(); } $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouseModel, $warehouseData); From 20bc73a17336b05ab13ae0be84d7ca3d9575db04 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 23 May 2024 17:17:25 -0400 Subject: [PATCH 48/54] relation update --- .../Inventory/Variants/Services/VariantService.php | 8 ++++---- .../Inventory/Warehouses/Services/WarehouseService.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 5aeba1f1c..0aed8330f 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -42,7 +42,7 @@ public static function createVariantsFromArray(Products $product, array $variant ]); $variantModel = (new CreateVariantsAction($variantDto, $user))->execute(); - $company = $variantDto->product->company()->get()->first(); + $company = $variantDto->product->company; if (isset($variant['custom_fields']) && ! empty($variant['custom_fields'])) { $variantModel->setAllCustomFields($variant['custom_fields']); @@ -110,7 +110,7 @@ public static function createDefaultVariant(Products $product, UserInterface $us ]); $variantModel = (new CreateVariantsAction($variantDto, $user))->execute(); - $company = $variantDto->product->company()->get()->first(); + $company = $variantDto->product->company; $warehouse = Warehouses::getDefault($company); @@ -137,10 +137,10 @@ public static function updateWarehouseVariant(Variants $variant, Warehouses $war if (isset($data['status'])) { $data['status_id'] = StatusRepository::getById( (int) $data['status']['id'], - $variant->product->company()->get()->first() + $variant->product->company )->getId(); } else { - $data['status_id'] = Status::getDefault($variant->product->company()->get()->first())->getId(); + $data['status_id'] = Status::getDefault($variant->product->company)->getId(); } $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouse, $data); diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php index 2f40bbbc7..593b741b1 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -31,15 +31,15 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $toDelete = array_diff($existedWarehouses, $warehousesId); foreach ($warehouses as $warehouseData) { - $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $variant->product->company()->get()->first()); + $warehouseModel = WarehouseRepository::getById((int) $warehouseData['warehouse_id'], $variant->product->company); if (isset($warehouseData['status'])) { $warehouseData['status_id'] = StatusRepository::getById( (int) $warehouseData['status']['id'], - $variant->product->company()->get()->first() + $variant->product->company )->getId(); } else { - $warehouseData['status_id'] = Status::getDefault($variant->product->company()->get()->first())->getId(); + $warehouseData['status_id'] = Status::getDefault($variant->product->company)->getId(); } $variantWarehousesDto = VariantsWarehouses::viaRequest($variant, $warehouseModel, $warehouseData); From 52760143dce8faae931bb962f920dc33e0f9277a Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 24 May 2024 17:07:22 -0400 Subject: [PATCH 49/54] refact: reset pass url --- src/Kanvas/Notifications/Templates/ResetPassword.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Kanvas/Notifications/Templates/ResetPassword.php b/src/Kanvas/Notifications/Templates/ResetPassword.php index 000f9e102..e2e356540 100644 --- a/src/Kanvas/Notifications/Templates/ResetPassword.php +++ b/src/Kanvas/Notifications/Templates/ResetPassword.php @@ -14,9 +14,11 @@ class ResetPassword extends Notification public function getData(): array { //replace url for app link + $resetUrl = $this->app->url . '/reset-password'; + return [ ...parent::getData(), - 'resetUrl' => $this->app->url . '/reset-password/' . $this->toUser->getAppProfile($this->app)->user_activation_forgot, + 'resetUrl' => $resetUrl . '/' . $this->toUser->getAppProfile($this->app)->user_activation_forgot, ]; } } From 5a3f02eb1171c412e85d94f8f50cfbe679e6a47b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 22:49:10 +0000 Subject: [PATCH 50/54] build(deps): bump league/csv from 9.15.0 to 9.16.0 Bumps [league/csv](https://github.com/thephpleague/csv) from 9.15.0 to 9.16.0. - [Release notes](https://github.com/thephpleague/csv/releases) - [Changelog](https://github.com/thephpleague/csv/blob/master/CHANGELOG.md) - [Commits](https://github.com/thephpleague/csv/compare/9.15.0...9.16.0) --- updated-dependencies: - dependency-name: league/csv dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/composer.lock b/composer.lock index f0caf34f3..6570f12cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4859,40 +4859,39 @@ }, { "name": "league/csv", - "version": "9.15.0", + "version": "9.16.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435" + "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", - "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/998280c6c34bd67d8125fdc8b45bae28d761b440", + "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440", "shasum": "" }, "require": { "ext-filter": "*", - "ext-json": "*", - "ext-mbstring": "*", "php": "^8.1.2" }, "require-dev": { - "doctrine/collections": "^2.1.4", + "doctrine/collections": "^2.2.2", "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^v3.22.0", + "friendsofphp/php-cs-fixer": "^3.57.1", "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^1.10.57", - "phpstan/phpstan-deprecation-rules": "^1.1.4", - "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.2", - "phpunit/phpunit": "^10.5.9", - "symfony/var-dumper": "^6.4.2" + "phpstan/phpstan": "^1.11.1", + "phpstan/phpstan-deprecation-rules": "^1.2.0", + "phpstan/phpstan-phpunit": "^1.4.0", + "phpstan/phpstan-strict-rules": "^1.6.0", + "phpunit/phpunit": "^10.5.16 || ^11.1.3", + "symfony/var-dumper": "^6.4.6 || ^7.0.7" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", - "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" + "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters", + "ext-mbstring": "Needed to ease transcoding CSV using mb stream filters" }, "type": "library", "extra": { @@ -4944,7 +4943,7 @@ "type": "github" } ], - "time": "2024-02-20T20:00:00+00:00" + "time": "2024-05-24T11:04:54+00:00" }, { "name": "league/flysystem", From a58780e6d2d3e5d625570d21346eade16c832979 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 22:49:17 +0000 Subject: [PATCH 51/54] build(deps): bump twilio/sdk from 8.0.1 to 8.1.0 Bumps [twilio/sdk](https://github.com/twilio/twilio-php) from 8.0.1 to 8.1.0. - [Release notes](https://github.com/twilio/twilio-php/releases) - [Changelog](https://github.com/twilio/twilio-php/blob/main/CHANGES.md) - [Commits](https://github.com/twilio/twilio-php/compare/8.0.1...8.1.0) --- updated-dependencies: - dependency-name: twilio/sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f0caf34f3..338655309 100644 --- a/composer.lock +++ b/composer.lock @@ -12934,16 +12934,16 @@ }, { "name": "twilio/sdk", - "version": "8.0.1", + "version": "8.1.0", "source": { "type": "git", "url": "https://github.com/twilio/twilio-php.git", - "reference": "161fbeb588f367e35e70a86841406ff6f0810b14" + "reference": "547e6ceca9a1491a645065f344ddb592a3456298" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twilio/twilio-php/zipball/161fbeb588f367e35e70a86841406ff6f0810b14", - "reference": "161fbeb588f367e35e70a86841406ff6f0810b14", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/547e6ceca9a1491a645065f344ddb592a3456298", + "reference": "547e6ceca9a1491a645065f344ddb592a3456298", "shasum": "" }, "require": { @@ -12981,9 +12981,9 @@ ], "support": { "issues": "https://github.com/twilio/twilio-php/issues", - "source": "https://github.com/twilio/twilio-php/tree/8.0.1" + "source": "https://github.com/twilio/twilio-php/tree/8.1.0" }, - "time": "2024-04-18T11:15:50+00:00" + "time": "2024-05-24T11:10:19+00:00" }, { "name": "vladimir-yuldashev/laravel-queue-rabbitmq", From 9740eed159a25a865ad8e137270c9e375044c0c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 22:49:26 +0000 Subject: [PATCH 52/54] build(deps): bump laravel-workflow/laravel-workflow Bumps [laravel-workflow/laravel-workflow](https://github.com/laravel-workflow/laravel-workflow) from 1.0.25 to 1.0.26. - [Release notes](https://github.com/laravel-workflow/laravel-workflow/releases) - [Commits](https://github.com/laravel-workflow/laravel-workflow/compare/1.0.25...1.0.26) --- updated-dependencies: - dependency-name: laravel-workflow/laravel-workflow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index f0caf34f3..ce49bd174 100644 --- a/composer.lock +++ b/composer.lock @@ -3849,16 +3849,16 @@ }, { "name": "laravel-workflow/laravel-workflow", - "version": "1.0.25", + "version": "1.0.26", "source": { "type": "git", "url": "https://github.com/laravel-workflow/laravel-workflow.git", - "reference": "b60f98e5be663ae40420398aeb2dd9782df09330" + "reference": "be2663cf67597870cdcbcadf5b031459758da00d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-workflow/laravel-workflow/zipball/b60f98e5be663ae40420398aeb2dd9782df09330", - "reference": "b60f98e5be663ae40420398aeb2dd9782df09330", + "url": "https://api.github.com/repos/laravel-workflow/laravel-workflow/zipball/be2663cf67597870cdcbcadf5b031459758da00d", + "reference": "be2663cf67597870cdcbcadf5b031459758da00d", "shasum": "" }, "require": { @@ -3900,9 +3900,9 @@ "description": "Durable workflow engine that allows users to write long running persistent distributed workflows (orchestrations) in PHP powered by Laravel queues.", "support": { "issues": "https://github.com/laravel-workflow/laravel-workflow/issues", - "source": "https://github.com/laravel-workflow/laravel-workflow/tree/1.0.25" + "source": "https://github.com/laravel-workflow/laravel-workflow/tree/1.0.26" }, - "time": "2024-05-19T10:16:44+00:00" + "time": "2024-05-24T14:03:25+00:00" }, { "name": "laravel/framework", @@ -8271,16 +8271,16 @@ }, { "name": "react/promise", - "version": "v3.1.0", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c" + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", - "reference": "e563d55d1641de1dea9f5e84f3cccc66d2bfe02c", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", "shasum": "" }, "require": { @@ -8332,7 +8332,7 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v3.1.0" + "source": "https://github.com/reactphp/promise/tree/v3.2.0" }, "funding": [ { @@ -8340,7 +8340,7 @@ "type": "open_collective" } ], - "time": "2023-11-16T16:21:57+00:00" + "time": "2024-05-24T10:39:05+00:00" }, { "name": "revolt/event-loop", From 9824d880cf54d2ba53465bb3d5c3b9440b9a3742 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 22:49:33 +0000 Subject: [PATCH 53/54] build(deps-dev): bump phpstan/phpstan from 1.11.1 to 1.11.2 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.1 to 1.11.2. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.1...1.11.2) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f0caf34f3..425df9731 100644 --- a/composer.lock +++ b/composer.lock @@ -14080,16 +14080,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.1", + "version": "1.11.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" + "reference": "0d5d4294a70deb7547db655c47685d680e39cfec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d5d4294a70deb7547db655c47685d680e39cfec", + "reference": "0d5d4294a70deb7547db655c47685d680e39cfec", "shasum": "" }, "require": { @@ -14134,7 +14134,7 @@ "type": "github" } ], - "time": "2024-05-15T08:00:59+00:00" + "time": "2024-05-24T13:23:04+00:00" }, { "name": "phpunit/php-code-coverage", From 7de2a5698b1d90f57d7024b0e61b1c94518e1d6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 May 2024 22:49:39 +0000 Subject: [PATCH 54/54] build(deps): bump shopify/shopify-api from 5.5.0 to 5.5.1 Bumps [shopify/shopify-api](https://github.com/Shopify/shopify-api-php) from 5.5.0 to 5.5.1. - [Release notes](https://github.com/Shopify/shopify-api-php/releases) - [Changelog](https://github.com/Shopify/shopify-api-php/blob/main/CHANGELOG.md) - [Commits](https://github.com/Shopify/shopify-api-php/compare/v5.5.0...v5.5.1) --- updated-dependencies: - dependency-name: shopify/shopify-api dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index f0caf34f3..beca6e7c0 100644 --- a/composer.lock +++ b/composer.lock @@ -2176,26 +2176,26 @@ }, { "name": "firebase/php-jwt", - "version": "v6.10.0", + "version": "v6.10.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" + "reference": "500501c2ce893c824c801da135d02661199f60c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5", + "reference": "500501c2ce893c824c801da135d02661199f60c5", "shasum": "" }, "require": { - "php": "^7.4||^8.0" + "php": "^8.0" }, "require-dev": { - "guzzlehttp/guzzle": "^6.5||^7.4", + "guzzlehttp/guzzle": "^7.4", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "psr/cache": "^1.0||^2.0", + "psr/cache": "^2.0||^3.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -2233,9 +2233,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.1" }, - "time": "2023-12-01T16:26:39+00:00" + "time": "2024-05-18T18:05:11+00:00" }, { "name": "fruitcake/php-cors", @@ -8705,16 +8705,16 @@ }, { "name": "shopify/shopify-api", - "version": "v5.5.0", + "version": "v5.5.1", "source": { "type": "git", "url": "https://github.com/Shopify/shopify-api-php.git", - "reference": "48d775f956b5ebec90f06200baca627fd07a9089" + "reference": "ed791f37706744578890d3a4b7ab8a7b9cfd7900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Shopify/shopify-api-php/zipball/48d775f956b5ebec90f06200baca627fd07a9089", - "reference": "48d775f956b5ebec90f06200baca627fd07a9089", + "url": "https://api.github.com/repos/Shopify/shopify-api-php/zipball/ed791f37706744578890d3a4b7ab8a7b9cfd7900", + "reference": "ed791f37706744578890d3a4b7ab8a7b9cfd7900", "shasum": "" }, "require": { @@ -8773,9 +8773,9 @@ ], "support": { "issues": "https://github.com/Shopify/shopify-api-php/issues", - "source": "https://github.com/Shopify/shopify-api-php/tree/v5.5.0" + "source": "https://github.com/Shopify/shopify-api-php/tree/v5.5.1" }, - "time": "2024-04-18T13:13:18+00:00" + "time": "2024-05-24T17:38:32+00:00" }, { "name": "silber/bouncer",