Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - Version 1.33 #1358

Merged
merged 85 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
e4fee72
Allow user to assign multiples warehouses
arfenis May 16, 2024
836df21
Move add warehouses logic to service
arfenis May 16, 2024
097e95d
remove warehouses from dto variant
arfenis May 16, 2024
5b0ef8d
Add method to add to warehouses
arfenis May 16, 2024
a7fd260
Update tests
arfenis May 16, 2024
259e01f
stylo
arfenis May 16, 2024
09d03ec
stylo2
arfenis May 16, 2024
cf3b580
again
arfenis May 16, 2024
42c670a
remove spaces
arfenis May 16, 2024
e550249
fix: shopify sync
kaioken May 18, 2024
4ce020b
fix: shopify sync
kaioken May 18, 2024
30e8751
fix: duplicate users on get
FredPeal May 20, 2024
c9e40fc
refact: fix upload iamgse
kaioken May 20, 2024
037c4c3
refact: fix upload iamgse
kaioken May 20, 2024
ec6d2c7
Merge pull request #1354 from bakaphp/hotfix-shopify-sync-price-stock
kaioken May 20, 2024
3d930d8
Merge pull request #1356 from bakaphp/fix-notification-duplicated
FredPeal May 20, 2024
cf76911
Remove warehouses assignation from service
arfenis May 20, 2024
62ae308
stylo
arfenis May 20, 2024
5c112c2
Merge branch 'development' of github.com:bakaphp/kanvas-ecosystem-api…
arfenis May 20, 2024
5edfbc0
Merge pull request #1342 from bakaphp/variant-multiple-warehouses
arfenis May 20, 2024
24897de
---
dependabot[bot] May 20, 2024
1b918c3
Merge pull request #1357 from bakaphp/dependabot/composer/laravel-wor…
kaioken May 20, 2024
9fdb396
refact: topics and reactions
kaioken May 21, 2024
58b0da5
Merge pull request #1359 from bakaphp/hotfix-shopify-sync-price-stock
kaioken May 21, 2024
65b5c81
remove nginx container from franken docker compose
rwhite27 May 21, 2024
bcac936
Merge pull request #1361 from bakaphp/feat-franken-php
rwhite27 May 21, 2024
94d7951
add schedule run to api pods.
rwhite27 May 21, 2024
0e132df
comment health cronjob
rwhite27 May 21, 2024
d4f6195
add another pod for the laravel scheduler
rwhite27 May 21, 2024
c3cce6f
run with work instead of run
rwhite27 May 21, 2024
cd38bc9
---
dependabot[bot] May 21, 2024
82da812
---
dependabot[bot] May 21, 2024
73806ba
Merge pull request #1366 from bakaphp/dependabot/composer/laravel/fra…
kaioken May 22, 2024
eaaf11d
Merge pull request #1365 from bakaphp/dependabot/composer/laravel/oct…
kaioken May 22, 2024
5265590
Merge pull request #1367 from bakaphp/hotfix-product-files
kaioken May 22, 2024
16414ee
refact: shopify user key
kaioken May 22, 2024
9a83d69
Merge pull request #1368 from bakaphp/hotfix-product-files
kaioken May 22, 2024
d687c17
Merge pull request #1364 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
ae2078c
add vpa and hpa to laravel scheduler pod
rwhite27 May 22, 2024
4546a79
Merge pull request #1369 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
9b57d7a
remove nginx and telemetry from laravel scheduler
rwhite27 May 22, 2024
48447b2
Merge pull request #1370 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
9913833
comment laravel scheduler
rwhite27 May 22, 2024
ec42dfd
Merge pull request #1371 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
fa5a5b2
readd laravel scheduler
rwhite27 May 22, 2024
fccb2b5
Merge pull request #1372 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
f436e22
readd schedule:run
rwhite27 May 22, 2024
75ba503
Merge pull request #1373 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
352e3dc
readd schedule:work command
rwhite27 May 22, 2024
4878573
Merge pull request #1374 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
4c477bc
sdaedaed
rwhite27 May 22, 2024
4a4b83e
Merge pull request #1375 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
9343d18
add cronjob for laravel scheduler
rwhite27 May 22, 2024
6fa743f
Merge pull request #1376 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
d37bb5f
turn success history to 0
rwhite27 May 22, 2024
921fcc4
Merge pull request #1377 from bakaphp/feat-schedule-command
rwhite27 May 22, 2024
4b8bb62
build(deps): bump league/flysystem-aws-s3-v3 from 3.27.0 to 3.28.0
dependabot[bot] May 22, 2024
f8f369f
Merge pull request #1378 from bakaphp/dependabot/composer/league/flys…
kaioken May 23, 2024
d60e7e9
Update array of warehouses on variants
arfenis May 23, 2024
de76ae1
Create services for warehouses
arfenis May 23, 2024
2d15da7
Move method to warehouses service
arfenis May 23, 2024
d28224b
Merge pull request #1384 from bakaphp/1.x
kaioken May 23, 2024
f6e37ee
user warehouses service for methods
arfenis May 23, 2024
10e564d
update variant warehouses dto optional fields
arfenis May 23, 2024
f1e53a2
use updateOrCreate on variantWarehouses update
arfenis May 23, 2024
e69e717
spacing
arfenis May 23, 2024
f567d06
stylo
arfenis May 23, 2024
f0ab6db
mapper
arfenis May 23, 2024
6f6fb75
action fix
arfenis May 23, 2024
9dd3ab3
remove user current company
arfenis May 23, 2024
20bc73a
relation update
arfenis May 23, 2024
cd41a5f
Merge pull request #1385 from bakaphp/update-variant-warehouses
arfenis May 23, 2024
5276014
refact: reset pass url
kaioken May 24, 2024
03e929f
Merge pull request #1390 from bakaphp/refact-reset-pass-url
kaioken May 24, 2024
68b9aef
Merge pull request #1391 from bakaphp/1.x
kaioken May 24, 2024
5a3f02e
build(deps): bump league/csv from 9.15.0 to 9.16.0
dependabot[bot] May 24, 2024
a58780e
build(deps): bump twilio/sdk from 8.0.1 to 8.1.0
dependabot[bot] May 24, 2024
9740eed
build(deps): bump laravel-workflow/laravel-workflow
dependabot[bot] May 24, 2024
9824d88
build(deps-dev): bump phpstan/phpstan from 1.11.1 to 1.11.2
dependabot[bot] May 24, 2024
7de2a56
build(deps): bump shopify/shopify-api from 5.5.0 to 5.5.1
dependabot[bot] May 24, 2024
b002a8a
Merge pull request #1396 from bakaphp/dependabot/composer/shopify/sho…
kaioken May 25, 2024
df3a2ef
Merge pull request #1395 from bakaphp/dependabot/composer/phpstan/php…
kaioken May 25, 2024
dda7ed4
Merge pull request #1394 from bakaphp/dependabot/composer/laravel-wor…
kaioken May 25, 2024
37ea752
Merge pull request #1393 from bakaphp/dependabot/composer/twilio/sdk-…
kaioken May 25, 2024
6f2ccc5
Merge pull request #1392 from bakaphp/dependabot/composer/league/csv-…
kaioken May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/KanvasInventoryDefaultUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]
Expand Down
47 changes: 25 additions & 22 deletions app/GraphQL/Inventory/Mutations/Variants/Variants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,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
{
Expand All @@ -46,29 +46,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);

WarehouseService::addToWarehouses(
$variantModel,
$warehouse,
$company,
$warehouseData
);
}
} else {
$status = Status::getDefault($company);
$warehouse = Warehouses::getDefault($company);

WarehouseService::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) {
Expand Down Expand Up @@ -104,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;
Expand Down Expand Up @@ -134,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();

Expand All @@ -155,17 +159,16 @@ public function updateVariantInWarehouse(mixed $root, array $req): VariantModel
}

/**
* @todo Remove and use softdelete.
* removeToWarehouse.
*/
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;
}
Expand Down
Loading
Loading