From 86e81ab453d98018adcdf363960fc944d77429f6 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Sat, 1 Jun 2024 22:31:42 -0400 Subject: [PATCH 001/140] feat: request deleted account --- .../Commands/DeleteUsersRequestedCommand.php | 49 +++++++++++++++++ .../Users/UserManagementMutation.php | 6 +++ ...4_05_31_045942_request_deleted_account.php | 33 ++++++++++++ graphql/schemas/Ecosystem/user.graphql | 5 ++ .../Actions/RequestDeleteAccountAction.php | 31 +++++++++++ .../Users/Models/RequestDeletedAccount.php | 30 +++++++++++ tests/GraphQL/Ecosystem/Users/UserTest.php | 52 ++++++++++++++++++- 7 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 app/Console/Commands/DeleteUsersRequestedCommand.php create mode 100644 database/migrations/2024_05_31_045942_request_deleted_account.php create mode 100644 src/Kanvas/Users/Actions/RequestDeleteAccountAction.php create mode 100644 src/Kanvas/Users/Models/RequestDeletedAccount.php diff --git a/app/Console/Commands/DeleteUsersRequestedCommand.php b/app/Console/Commands/DeleteUsersRequestedCommand.php new file mode 100644 index 000000000..ab748e400 --- /dev/null +++ b/app/Console/Commands/DeleteUsersRequestedCommand.php @@ -0,0 +1,49 @@ +info('Deleting user'); + $appsId = $this->argument('apps_id') ?? 1; + $app = Apps::find($appsId); + $days = $app->get('days_to_delete') ?? 30; + $users = RequestDeletedAccount::where('apps_id', $app->getId()) + ->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) + ->where('is_deleted', 0) + ->get(); + foreach ($users as $user) { + echo 'Deleting user: ' . $user->email . PHP_EOL; + $user->associateUsers()->deActive(); + } + } +} diff --git a/app/GraphQL/Ecosystem/Mutations/Users/UserManagementMutation.php b/app/GraphQL/Ecosystem/Mutations/Users/UserManagementMutation.php index c30cb2e3c..9d8ef5072 100644 --- a/app/GraphQL/Ecosystem/Mutations/Users/UserManagementMutation.php +++ b/app/GraphQL/Ecosystem/Mutations/Users/UserManagementMutation.php @@ -19,6 +19,7 @@ use Kanvas\Notifications\Templates\ChangePasswordUserLogged; use Kanvas\Users\Actions\CreateInviteAction; use Kanvas\Users\Actions\ProcessInviteAction; +use Kanvas\Users\Actions\RequestDeleteAccountAction as RequestDeleteAction; use Kanvas\Users\DataTransferObject\CompleteInviteInput; use Kanvas\Users\DataTransferObject\Invite as InviteDto; use Kanvas\Users\Models\Users; @@ -184,4 +185,9 @@ public function updatePhotoProfile(mixed $rootValue, array $request): Users return $user; } + + public function requestDeleteAccount(mixed $rootValue, array $request): bool + { + return (new RequestDeleteAction(app(Apps::class), auth()->user()))->execute(); + } } diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php new file mode 100644 index 000000000..7829cee52 --- /dev/null +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -0,0 +1,33 @@ +id(); + $table->bigInteger('apps_id')->unsigned(); + $table->bigInteger('users_id')->unsigned(); + $table->string('email'); + $table->string('reason')->nullable(); + $table->dateTime('request_date'); + $table->integer('is_deleted')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('request_deleted_accounts'); + } +}; diff --git a/graphql/schemas/Ecosystem/user.graphql b/graphql/schemas/Ecosystem/user.graphql index c3bdde818..7553668ec 100644 --- a/graphql/schemas/Ecosystem/user.graphql +++ b/graphql/schemas/Ecosystem/user.graphql @@ -236,6 +236,11 @@ extend type Mutation { @field( resolver: "App\\GraphQL\\Ecosystem\\Mutations\\Users\\TwoFactorAuthMutation@setToggleTwoFactorAuthIn30Days" ) + requestDeleteAccount: Boolean! + @guard + @field( + resolver: "App\\GraphQL\\Ecosystem\\Mutations\\Users\\UserManagementMutation@requestDeleteAccount" + ) } type Query @guard { diff --git a/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php b/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php new file mode 100644 index 000000000..5673d3140 --- /dev/null +++ b/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php @@ -0,0 +1,31 @@ + $this->app->getId(), + 'users_id' => $this->user->getId(), + 'email' => $this->user->email, + 'request_date' => date('Y-m-d H:i:s'), + ]); + + return true; + + } +} diff --git a/src/Kanvas/Users/Models/RequestDeletedAccount.php b/src/Kanvas/Users/Models/RequestDeletedAccount.php new file mode 100644 index 000000000..a5791328b --- /dev/null +++ b/src/Kanvas/Users/Models/RequestDeletedAccount.php @@ -0,0 +1,30 @@ +belongsTo(UsersAssociatedApps::class, 'users_id', 'users_id') + ->where('apps_id', $this->apps_id); + } +} diff --git a/tests/GraphQL/Ecosystem/Users/UserTest.php b/tests/GraphQL/Ecosystem/Users/UserTest.php index f88d00137..d34be7781 100644 --- a/tests/GraphQL/Ecosystem/Users/UserTest.php +++ b/tests/GraphQL/Ecosystem/Users/UserTest.php @@ -7,9 +7,9 @@ use Illuminate\Support\Facades\Mail; use Kanvas\Apps\Models\Apps; use Kanvas\Auth\DataTransferObject\LoginInput; +use Kanvas\Enums\AppEnums; use Kanvas\Users\Models\Users; use Tests\TestCase; -use Kanvas\Enums\AppEnums; class UserTest extends TestCase { @@ -281,4 +281,54 @@ public function testDeleteUserSetting() ], ]); } + + public function testRequestDeleteAccount() + { + // $loginData = self::loginData(); + // $email = $loginData->getEmail(); + // $password = $loginData->getPassword(); + + // $response = $this->graphQL(/** @lang GraphQL */ + // ' + // mutation register($data: RegisterInput!) { + // register(data: $data) { + // user{ + // email + // } + // token{ + // token + // refresh_token + // token_expires + // refresh_token_expires + // time + // timezone + // } + // } + // } + // ', + // [ + // 'data' => [ + // 'email' => $email, + // 'password' => $password, + // 'password_confirmation' => $password, + // ], + // ] + // ); + // $user = Users::getByEmail($email); + // $this->actingAs($user, 'api'); + + $this->graphQL(/** @lang GraphQL */ + ' + mutation requestDeleteAccount { + requestDeleteAccount + } + ' + )->assertJson([ + 'data' => [ + 'requestDeleteAccount' => true, + ], + ]); + + + } } From d51c44e77707078ca05f34c084a62f20af60c2a4 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Sat, 1 Jun 2024 22:32:46 -0400 Subject: [PATCH 002/140] refactor: delete comments --- tests/GraphQL/Ecosystem/Users/UserTest.php | 33 ---------------------- 1 file changed, 33 deletions(-) diff --git a/tests/GraphQL/Ecosystem/Users/UserTest.php b/tests/GraphQL/Ecosystem/Users/UserTest.php index d34be7781..6f24faacf 100644 --- a/tests/GraphQL/Ecosystem/Users/UserTest.php +++ b/tests/GraphQL/Ecosystem/Users/UserTest.php @@ -284,39 +284,6 @@ public function testDeleteUserSetting() public function testRequestDeleteAccount() { - // $loginData = self::loginData(); - // $email = $loginData->getEmail(); - // $password = $loginData->getPassword(); - - // $response = $this->graphQL(/** @lang GraphQL */ - // ' - // mutation register($data: RegisterInput!) { - // register(data: $data) { - // user{ - // email - // } - // token{ - // token - // refresh_token - // token_expires - // refresh_token_expires - // time - // timezone - // } - // } - // } - // ', - // [ - // 'data' => [ - // 'email' => $email, - // 'password' => $password, - // 'password_confirmation' => $password, - // ], - // ] - // ); - // $user = Users::getByEmail($email); - // $this->actingAs($user, 'api'); - $this->graphQL(/** @lang GraphQL */ ' mutation requestDeleteAccount { From 16583b0674ff3c096e36c263715abfae9d81f17a Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 2 Jun 2024 02:34:19 +0000 Subject: [PATCH 003/140] Apply fixes from StyleCI --- app/Console/Commands/DeleteUsersRequestedCommand.php | 2 +- .../migrations/2024_05_31_045942_request_deleted_account.php | 3 +-- src/Kanvas/Users/Actions/RequestDeleteAccountAction.php | 1 - src/Kanvas/Users/Models/RequestDeletedAccount.php | 1 - tests/GraphQL/Ecosystem/Users/UserTest.php | 2 -- 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Console/Commands/DeleteUsersRequestedCommand.php b/app/Console/Commands/DeleteUsersRequestedCommand.php index ab748e400..475177228 100644 --- a/app/Console/Commands/DeleteUsersRequestedCommand.php +++ b/app/Console/Commands/DeleteUsersRequestedCommand.php @@ -38,7 +38,7 @@ public function handle() $app = Apps::find($appsId); $days = $app->get('days_to_delete') ?? 30; $users = RequestDeletedAccount::where('apps_id', $app->getId()) - ->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) + ->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) ->where('is_deleted', 0) ->get(); foreach ($users as $user) { diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php index 7829cee52..f60333f65 100644 --- a/database/migrations/2024_05_31_045942_request_deleted_account.php +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class () extends Migration { /** * Run the migrations. */ diff --git a/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php b/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php index 5673d3140..ec59e8fe2 100644 --- a/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php +++ b/src/Kanvas/Users/Actions/RequestDeleteAccountAction.php @@ -26,6 +26,5 @@ public function execute(): bool ]); return true; - } } diff --git a/src/Kanvas/Users/Models/RequestDeletedAccount.php b/src/Kanvas/Users/Models/RequestDeletedAccount.php index a5791328b..64bc4958f 100644 --- a/src/Kanvas/Users/Models/RequestDeletedAccount.php +++ b/src/Kanvas/Users/Models/RequestDeletedAccount.php @@ -18,7 +18,6 @@ */ class RequestDeletedAccount extends BaseModel { - protected $table = 'request_deleted_accounts'; protected $guarded = []; diff --git a/tests/GraphQL/Ecosystem/Users/UserTest.php b/tests/GraphQL/Ecosystem/Users/UserTest.php index 6f24faacf..e7aa12349 100644 --- a/tests/GraphQL/Ecosystem/Users/UserTest.php +++ b/tests/GraphQL/Ecosystem/Users/UserTest.php @@ -295,7 +295,5 @@ public function testRequestDeleteAccount() 'requestDeleteAccount' => true, ], ]); - - } } From 5cd665f7ddf3f30961906091e17c6d8bb1abd6e9 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Sun, 2 Jun 2024 00:01:33 -0400 Subject: [PATCH 004/140] refactor: delete request deleted account if the user do login --- app/Providers/EventServiceProvider.php | 7 +++++-- .../Sessions/Observers/SessionObserver.php | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/Kanvas/Sessions/Observers/SessionObserver.php diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index f18ee81a4..7bcd99f73 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -29,18 +29,20 @@ use Kanvas\Inventory\Warehouses\Observers\WarehouseObserver; use Kanvas\Notifications\Events\PushNotificationsEvent; use Kanvas\Notifications\Listeners\NotificationsListener; +use Kanvas\Sessions\Models\Sessions; +use Kanvas\Sessions\Observers\SessionObserver; use Kanvas\Social\Messages\Models\UserMessage; use Kanvas\Social\Messages\Models\UserMessageActivity; use Kanvas\Social\Messages\Observers\UserMessageActivityObserver; use Kanvas\Social\Messages\Observers\UserMessageObserver; use Kanvas\Social\UsersLists\Models\UserList; use Kanvas\Social\UsersLists\Observers\UsersListsObserver; +use Kanvas\Users\Models\UserCompanyApps; use Kanvas\Users\Models\Users; use Kanvas\Users\Models\UsersAssociatedApps; use Kanvas\Users\Observers\UsersAssociatedAppsObserver; -use Kanvas\Users\Observers\UsersObserver; -use Kanvas\Users\Models\UserCompanyApps; use Kanvas\Users\Observers\UsersAssociatedCompaniesObserver; +use Kanvas\Users\Observers\UsersObserver; class EventServiceProvider extends ServiceProvider { @@ -79,6 +81,7 @@ public function boot() UsersAssociatedApps::observe(UsersAssociatedAppsObserver::class); UserCompanyApps::observe(UsersAssociatedCompaniesObserver::class); ProductsCategories::observe(ProductsCategoriesObserver::class); + Sessions::observe(SessionObserver::class); } /** diff --git a/src/Kanvas/Sessions/Observers/SessionObserver.php b/src/Kanvas/Sessions/Observers/SessionObserver.php new file mode 100644 index 000000000..2944cea2e --- /dev/null +++ b/src/Kanvas/Sessions/Observers/SessionObserver.php @@ -0,0 +1,18 @@ +users_id) + ->where('apps_id', $session->apps_id) + ->update(['is_deleted' => 1]); + } +} From ffcde3c925978a06b9e82e02fd1f175d9b5f5538 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 2 Jun 2024 22:01:56 -0400 Subject: [PATCH 005/140] feat: task list --- .../2024_06_03_011634_create_task_list.php | 46 +++++++++++++++++++ .../ActionEngine/Tasks/Models/TaskList.php | 27 +++++++++++ .../Tasks/Models/TaskListItem.php | 33 +++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 database/migrations/ActionEngine/2024_06_03_011634_create_task_list.php create mode 100644 src/Domains/ActionEngine/Tasks/Models/TaskList.php create mode 100644 src/Domains/ActionEngine/Tasks/Models/TaskListItem.php diff --git a/database/migrations/ActionEngine/2024_06_03_011634_create_task_list.php b/database/migrations/ActionEngine/2024_06_03_011634_create_task_list.php new file mode 100644 index 000000000..d8117b9b1 --- /dev/null +++ b/database/migrations/ActionEngine/2024_06_03_011634_create_task_list.php @@ -0,0 +1,46 @@ +id(); + $table->uuid('uuid')->index(); + $table->bigInteger('apps_id')->index(); + $table->bigInteger('companies_id')->index(); + $table->bigInteger('users_id')->index(); + $table->string('name'); + $table->json('config')->nullable(); + $table->timestamps(); + $table->tinyInteger('is_deleted')->default(0)->index(); + }); + + Schema::create('company_task_list_items', function (Blueprint $table) { + $table->id(); + $table->foreignId('task_list_id')->constrained('company_task_list')->onDelete('cascade'); + $table->string('name'); + $table->bigInteger('companies_action_id')->index(); + $table->enum('status', ['pending', 'in_progress', 'completed'])->default('pending')->comment('pending, in_progress, completed')->index(); + $table->json('config')->nullable(); + $table->decimal('weight', 8, 2)->default(0)->index(); + $table->timestamps(); + $table->tinyInteger('is_deleted')->default(0)->index(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('company_task_list'); + Schema::dropIfExists('company_task_list_items'); + } +}; diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskList.php b/src/Domains/ActionEngine/Tasks/Models/TaskList.php new file mode 100644 index 000000000..51624faff --- /dev/null +++ b/src/Domains/ActionEngine/Tasks/Models/TaskList.php @@ -0,0 +1,27 @@ +belongsTo(TaskList::class, 'task_list_id'); + } +} From f00071019b1ef7aab0328ef24d4639d03be2c96b Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 2 Jun 2024 23:13:00 -0400 Subject: [PATCH 006/140] refact: add tasks --- composer.json | 1 + composer.lock | 304 +++++++++--------- graphql/schema.graphql | 1 + graphql/schemas/ActionEngine/action.graphql | 30 ++ graphql/schemas/ActionEngine/task.graphql | 27 ++ .../ActionEngine/Actions/Models/Action.php | 2 +- .../Actions/Models/CompanyAction.php | 2 +- .../Engagegments/Models/Engagement.php | 2 +- .../Pipelines/Models/Pipeline.php | 2 +- .../Pipelines/Models/PipelineStage.php | 2 +- .../Pipelines/Models/PipelineStageMessage.php | 2 +- .../ActionEngine/Tasks/Models/TaskList.php | 8 +- .../Tasks/Models/TaskListItem.php | 8 +- .../Activities/CreateUserActivity.php | 3 +- 14 files changed, 236 insertions(+), 158 deletions(-) create mode 100644 graphql/schemas/ActionEngine/action.graphql create mode 100644 graphql/schemas/ActionEngine/task.graphql diff --git a/composer.json b/composer.json index bbded12e7..ac883ea1e 100644 --- a/composer.json +++ b/composer.json @@ -75,6 +75,7 @@ "Kanvas\\Souk\\": "src/Domains/Souk", "Kanvas\\Workflow\\": "src/Domains/Workflow", "Kanvas\\Connectors\\": "src/Domains/Connectors", + "Kanvas\\ActionEngine\\": "src/Domains/ActionEngine", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } diff --git a/composer.lock b/composer.lock index 7a7585646..735d8d963 100644 --- a/composer.lock +++ b/composer.lock @@ -384,16 +384,16 @@ }, { "name": "amphp/dns", - "version": "v2.1.2", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/amphp/dns.git", - "reference": "04c88e67bef804203df934703bd422ea72f46b0e" + "reference": "758266b0ea7470e2e42cd098493bc6d6c7100cf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/dns/zipball/04c88e67bef804203df934703bd422ea72f46b0e", - "reference": "04c88e67bef804203df934703bd422ea72f46b0e", + "url": "https://api.github.com/repos/amphp/dns/zipball/758266b0ea7470e2e42cd098493bc6d6c7100cf7", + "reference": "758266b0ea7470e2e42cd098493bc6d6c7100cf7", "shasum": "" }, "require": { @@ -460,7 +460,7 @@ ], "support": { "issues": "https://github.com/amphp/dns/issues", - "source": "https://github.com/amphp/dns/tree/v2.1.2" + "source": "https://github.com/amphp/dns/tree/v2.2.0" }, "funding": [ { @@ -468,7 +468,7 @@ "type": "github" } ], - "time": "2024-04-19T03:49:29+00:00" + "time": "2024-06-02T19:54:12+00:00" }, { "name": "amphp/parallel", @@ -1195,16 +1195,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.308.4", + "version": "3.308.7", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6" + "reference": "97074bd8cdd9fe498570821cefa4868fa3353cf3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6", - "reference": "c88e9df7e076b6e2c652a1c87d2c3af0a9ac30b6", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/97074bd8cdd9fe498570821cefa4868fa3353cf3", + "reference": "97074bd8cdd9fe498570821cefa4868fa3353cf3", "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.308.4" + "source": "https://github.com/aws/aws-sdk-php/tree/3.308.7" }, - "time": "2024-05-28T18:05:38+00:00" + "time": "2024-05-31T18:17:12+00:00" }, { "name": "berkayk/onesignal-laravel", @@ -2503,16 +2503,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.356.0", + "version": "v0.358.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "8e22b0a6f661f2db3f99abb6ee5a1dcf28d370e7" + "reference": "a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/8e22b0a6f661f2db3f99abb6ee5a1dcf28d370e7", - "reference": "8e22b0a6f661f2db3f99abb6ee5a1dcf28d370e7", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd", + "reference": "a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd", "shasum": "" }, "require": { @@ -2541,22 +2541,22 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.356.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.358.0" }, - "time": "2024-05-18T01:10:18+00:00" + "time": "2024-06-03T01:02:16+00:00" }, { "name": "google/auth", - "version": "v1.39.0", + "version": "v1.40.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "23e8e696d87f8d7dfefbd347ca1c99ce17ecb368" + "reference": "bff9f2d01677e71a98394b5ac981b99523df5178" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/23e8e696d87f8d7dfefbd347ca1c99ce17ecb368", - "reference": "23e8e696d87f8d7dfefbd347ca1c99ce17ecb368", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bff9f2d01677e71a98394b5ac981b99523df5178", + "reference": "bff9f2d01677e71a98394b5ac981b99523df5178", "shasum": "" }, "require": { @@ -2601,27 +2601,27 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.39.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.40.0" }, - "time": "2024-05-02T16:03:51+00:00" + "time": "2024-05-31T19:16:15+00:00" }, { "name": "google/cloud-core", - "version": "v1.58.1", + "version": "v1.58.2", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "db3e0ab25103e0ca953f6e1e0ca5a39e363b8988" + "reference": "56df58d70cca3c429e2cfd32270e42596f6c002f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/db3e0ab25103e0ca953f6e1e0ca5a39e363b8988", - "reference": "db3e0ab25103e0ca953f6e1e0ca5a39e363b8988", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/56df58d70cca3c429e2cfd32270e42596f6c002f", + "reference": "56df58d70cca3c429e2cfd32270e42596f6c002f", "shasum": "" }, "require": { "google/auth": "^1.34", - "google/gax": "^1.30", + "google/gax": "^1.34.0", "guzzlehttp/guzzle": "^6.5.8|^7.4.4", "guzzlehttp/promises": "^1.4||^2.0", "guzzlehttp/psr7": "^2.6", @@ -2667,9 +2667,9 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.58.1" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.58.2" }, - "time": "2024-05-03T18:32:44+00:00" + "time": "2024-06-01T03:14:01+00:00" }, { "name": "google/cloud-storage", @@ -2782,16 +2782,16 @@ }, { "name": "google/gax", - "version": "v1.33.0", + "version": "v1.34.0", "source": { "type": "git", "url": "https://github.com/googleapis/gax-php.git", - "reference": "12a158e9b503df0087ebf9e218e8d75dc815a521" + "reference": "28aa3e95969a75b278606a88448992a6396a119e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/gax-php/zipball/12a158e9b503df0087ebf9e218e8d75dc815a521", - "reference": "12a158e9b503df0087ebf9e218e8d75dc815a521", + "url": "https://api.github.com/repos/googleapis/gax-php/zipball/28aa3e95969a75b278606a88448992a6396a119e", + "reference": "28aa3e95969a75b278606a88448992a6396a119e", "shasum": "" }, "require": { @@ -2833,9 +2833,9 @@ ], "support": { "issues": "https://github.com/googleapis/gax-php/issues", - "source": "https://github.com/googleapis/gax-php/tree/v1.33.0" + "source": "https://github.com/googleapis/gax-php/tree/v1.34.0" }, - "time": "2024-05-14T14:55:14+00:00" + "time": "2024-05-30T00:35:13+00:00" }, { "name": "google/grpc-gcp", @@ -2884,20 +2884,20 @@ }, { "name": "google/longrunning", - "version": "0.4.2", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/googleapis/php-longrunning.git", - "reference": "dd38c97ee348ad73bfb581aa276a536161f4b181" + "reference": "ed718a735e407826c3332b7197a44602eb03e608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/dd38c97ee348ad73bfb581aa276a536161f4b181", - "reference": "dd38c97ee348ad73bfb581aa276a536161f4b181", + "url": "https://api.github.com/repos/googleapis/php-longrunning/zipball/ed718a735e407826c3332b7197a44602eb03e608", + "reference": "ed718a735e407826c3332b7197a44602eb03e608", "shasum": "" }, "require-dev": { - "google/gax": "^1.30", + "google/gax": "^1.34.0", "phpunit/phpunit": "^9.0" }, "type": "library", @@ -2922,9 +2922,9 @@ ], "description": "Google LongRunning Client for PHP", "support": { - "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.2" + "source": "https://github.com/googleapis/php-longrunning/tree/v0.4.3" }, - "time": "2024-05-03T18:32:44+00:00" + "time": "2024-06-01T03:14:01+00:00" }, { "name": "google/protobuf", @@ -7464,16 +7464,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.29.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4", + "reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4", "shasum": "" }, "require": { @@ -7505,9 +7505,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-05-31T08:52:43+00:00" }, { "name": "powersync/authorizenet-sdk-php", @@ -9903,16 +9903,16 @@ }, { "name": "symfony/clock", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "2008671acb4a30b01c453de193cf9c80549ebda6" + "reference": "fe47b7cf6a68c045c37928aa89a39d5eb9a2b37c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/2008671acb4a30b01c453de193cf9c80549ebda6", - "reference": "2008671acb4a30b01c453de193cf9c80549ebda6", + "url": "https://api.github.com/repos/symfony/clock/zipball/fe47b7cf6a68c045c37928aa89a39d5eb9a2b37c", + "reference": "fe47b7cf6a68c045c37928aa89a39d5eb9a2b37c", "shasum": "" }, "require": { @@ -9957,7 +9957,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v7.0.7" + "source": "https://github.com/symfony/clock/tree/v7.1.0" }, "funding": [ { @@ -9973,20 +9973,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/console", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c981e0e9380ce9f146416bde3150c79197ce9986" + "reference": "5bcde9e0b2ea9bd9772bca17618365ea921c5707" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c981e0e9380ce9f146416bde3150c79197ce9986", - "reference": "c981e0e9380ce9f146416bde3150c79197ce9986", + "url": "https://api.github.com/repos/symfony/console/zipball/5bcde9e0b2ea9bd9772bca17618365ea921c5707", + "reference": "5bcde9e0b2ea9bd9772bca17618365ea921c5707", "shasum": "" }, "require": { @@ -10050,7 +10050,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.0.7" + "source": "https://github.com/symfony/console/tree/v7.1.0" }, "funding": [ { @@ -10066,20 +10066,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-17T10:55:18+00:00" }, { "name": "symfony/css-selector", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc" + "reference": "843f2f7ac5e4c5bf0ec77daef23ca6d4d8922adc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc", - "reference": "b08a4ad89e84b29cec285b7b1f781a7ae51cf4bc", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/843f2f7ac5e4c5bf0ec77daef23ca6d4d8922adc", + "reference": "843f2f7ac5e4c5bf0ec77daef23ca6d4d8922adc", "shasum": "" }, "require": { @@ -10115,7 +10115,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v7.0.7" + "source": "https://github.com/symfony/css-selector/tree/v7.1.0" }, "funding": [ { @@ -10131,7 +10131,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/deprecation-contracts", @@ -10202,16 +10202,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "cf97429887e40480c847bfeb6c3991e1e2c086ab" + "reference": "477d911900bf32fc43a675f78d4cbaedbb78378f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/cf97429887e40480c847bfeb6c3991e1e2c086ab", - "reference": "cf97429887e40480c847bfeb6c3991e1e2c086ab", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/477d911900bf32fc43a675f78d4cbaedbb78378f", + "reference": "477d911900bf32fc43a675f78d4cbaedbb78378f", "shasum": "" }, "require": { @@ -10257,7 +10257,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.0.7" + "source": "https://github.com/symfony/error-handler/tree/v7.1.0" }, "funding": [ { @@ -10273,7 +10273,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-17T10:55:18+00:00" }, { "name": "symfony/event-dispatcher", @@ -10497,16 +10497,16 @@ }, { "name": "symfony/finder", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c" + "reference": "fb6c2d65c3dbf7ad83201a4168d4510c8dddaac7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4d58f0f4fe95a30d7b538d71197135483560b97c", - "reference": "4d58f0f4fe95a30d7b538d71197135483560b97c", + "url": "https://api.github.com/repos/symfony/finder/zipball/fb6c2d65c3dbf7ad83201a4168d4510c8dddaac7", + "reference": "fb6c2d65c3dbf7ad83201a4168d4510c8dddaac7", "shasum": "" }, "require": { @@ -10541,7 +10541,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.0.7" + "source": "https://github.com/symfony/finder/tree/v7.1.0" }, "funding": [ { @@ -10557,7 +10557,7 @@ "type": "tidelift" } ], - "time": "2024-04-28T11:44:19+00:00" + "time": "2024-04-28T18:29:00+00:00" }, { "name": "symfony/http-client", @@ -10733,16 +10733,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8" + "reference": "f9c54a6b1697d0b3b3d541e89e7843cdb3c9bfb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/0194e064b8bdc29381462f790bab04e1cac8fdc8", - "reference": "0194e064b8bdc29381462f790bab04e1cac8fdc8", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f9c54a6b1697d0b3b3d541e89e7843cdb3c9bfb7", + "reference": "f9c54a6b1697d0b3b3d541e89e7843cdb3c9bfb7", "shasum": "" }, "require": { @@ -10790,7 +10790,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.0.7" + "source": "https://github.com/symfony/http-foundation/tree/v7.1.0" }, "funding": [ { @@ -10806,25 +10806,26 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-20T16:41:11+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "e07bb9bd86e7cd8ba2d3d9c618eec9d1bbe06d25" + "reference": "7eb093ee3911354aa13704d757127535dd8d371f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/e07bb9bd86e7cd8ba2d3d9c618eec9d1bbe06d25", - "reference": "e07bb9bd86e7cd8ba2d3d9c618eec9d1bbe06d25", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7eb093ee3911354aa13704d757127535dd8d371f", + "reference": "7eb093ee3911354aa13704d757127535dd8d371f", "shasum": "" }, "require": { "php": ">=8.2", "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/error-handler": "^6.4|^7.0", "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", @@ -10865,9 +10866,9 @@ "symfony/finder": "^6.4|^7.0", "symfony/http-client-contracts": "^2.5|^3", "symfony/process": "^6.4|^7.0", - "symfony/property-access": "^6.4|^7.0", + "symfony/property-access": "^7.1", "symfony/routing": "^6.4|^7.0", - "symfony/serializer": "^6.4.4|^7.0.4", + "symfony/serializer": "^7.1", "symfony/stopwatch": "^6.4|^7.0", "symfony/translation": "^6.4|^7.0", "symfony/translation-contracts": "^2.5|^3", @@ -10903,7 +10904,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.0.7" + "source": "https://github.com/symfony/http-kernel/tree/v7.1.0" }, "funding": [ { @@ -10919,7 +10920,7 @@ "type": "tidelift" } ], - "time": "2024-04-29T12:20:25+00:00" + "time": "2024-05-31T07:46:30+00:00" }, { "name": "symfony/mailer", @@ -11156,16 +11157,16 @@ }, { "name": "symfony/options-resolver", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa" + "reference": "9564f64c16f99e29f252eafc642965e8fcb755ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa", - "reference": "23cc173858776ad451e31f053b1c9f47840b2cfa", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9564f64c16f99e29f252eafc642965e8fcb755ce", + "reference": "9564f64c16f99e29f252eafc642965e8fcb755ce", "shasum": "" }, "require": { @@ -11203,7 +11204,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.0.7" + "source": "https://github.com/symfony/options-resolver/tree/v7.1.0" }, "funding": [ { @@ -11219,7 +11220,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/polyfill-ctype", @@ -11934,16 +11935,16 @@ }, { "name": "symfony/process", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0" + "reference": "56c8a1ea51eb70003fee94a78c7d6d0f44832ce7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3839e56b94dd1dbd13235d27504e66baf23faba0", - "reference": "3839e56b94dd1dbd13235d27504e66baf23faba0", + "url": "https://api.github.com/repos/symfony/process/zipball/56c8a1ea51eb70003fee94a78c7d6d0f44832ce7", + "reference": "56c8a1ea51eb70003fee94a78c7d6d0f44832ce7", "shasum": "" }, "require": { @@ -11975,7 +11976,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.0.7" + "source": "https://github.com/symfony/process/tree/v7.1.0" }, "funding": [ { @@ -11991,20 +11992,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-17T10:55:18+00:00" }, { "name": "symfony/psr-http-message-bridge", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/psr-http-message-bridge.git", - "reference": "727befd41438a8feb64066871d3656d8cbdcdbe2" + "reference": "db9f8f3077068f1fbcdd84c428241dc0f7bd87fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/727befd41438a8feb64066871d3656d8cbdcdbe2", - "reference": "727befd41438a8feb64066871d3656d8cbdcdbe2", + "url": "https://api.github.com/repos/symfony/psr-http-message-bridge/zipball/db9f8f3077068f1fbcdd84c428241dc0f7bd87fb", + "reference": "db9f8f3077068f1fbcdd84c428241dc0f7bd87fb", "shasum": "" }, "require": { @@ -12058,7 +12059,7 @@ "psr-7" ], "support": { - "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.0.7" + "source": "https://github.com/symfony/psr-http-message-bridge/tree/v7.1.0" }, "funding": [ { @@ -12074,20 +12075,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/routing", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b" + "reference": "0ec2f36fbd769467f98c9c02cea1b76ed117115d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b", - "reference": "9f82bf7766ccc9c22ab7aeb9bebb98351483fa5b", + "url": "https://api.github.com/repos/symfony/routing/zipball/0ec2f36fbd769467f98c9c02cea1b76ed117115d", + "reference": "0ec2f36fbd769467f98c9c02cea1b76ed117115d", "shasum": "" }, "require": { @@ -12139,7 +12140,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.0.7" + "source": "https://github.com/symfony/routing/tree/v7.1.0" }, "funding": [ { @@ -12155,7 +12156,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-28T06:54:05+00:00" }, { "name": "symfony/service-contracts", @@ -12242,16 +12243,16 @@ }, { "name": "symfony/string", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63" + "reference": "6f41b185e742737917e6f2e3eca37767fba5f17a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e405b5424dc2528e02e31ba26b83a79fd4eb8f63", - "reference": "e405b5424dc2528e02e31ba26b83a79fd4eb8f63", + "url": "https://api.github.com/repos/symfony/string/zipball/6f41b185e742737917e6f2e3eca37767fba5f17a", + "reference": "6f41b185e742737917e6f2e3eca37767fba5f17a", "shasum": "" }, "require": { @@ -12265,6 +12266,7 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { + "symfony/emoji": "^7.1", "symfony/error-handler": "^6.4|^7.0", "symfony/http-client": "^6.4|^7.0", "symfony/intl": "^6.4|^7.0", @@ -12308,7 +12310,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.7" + "source": "https://github.com/symfony/string/tree/v7.1.0" }, "funding": [ { @@ -12324,20 +12326,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-17T10:55:18+00:00" }, { "name": "symfony/translation", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "1515e03afaa93e6419aba5d5c9d209159317100b" + "reference": "583d18e461eada8270ca44b7d99f07abf1ab048e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/1515e03afaa93e6419aba5d5c9d209159317100b", - "reference": "1515e03afaa93e6419aba5d5c9d209159317100b", + "url": "https://api.github.com/repos/symfony/translation/zipball/583d18e461eada8270ca44b7d99f07abf1ab048e", + "reference": "583d18e461eada8270ca44b7d99f07abf1ab048e", "shasum": "" }, "require": { @@ -12402,7 +12404,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.0.7" + "source": "https://github.com/symfony/translation/tree/v7.1.0" }, "funding": [ { @@ -12418,7 +12420,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-02T11:50:05+00:00" }, { "name": "symfony/translation-contracts", @@ -12500,16 +12502,16 @@ }, { "name": "symfony/uid", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "4f3a5d181999e25918586c8369de09e7814e7be2" + "reference": "3bbcb15f311b86f72486826ade080d8013231f96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/4f3a5d181999e25918586c8369de09e7814e7be2", - "reference": "4f3a5d181999e25918586c8369de09e7814e7be2", + "url": "https://api.github.com/repos/symfony/uid/zipball/3bbcb15f311b86f72486826ade080d8013231f96", + "reference": "3bbcb15f311b86f72486826ade080d8013231f96", "shasum": "" }, "require": { @@ -12554,7 +12556,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v7.0.7" + "source": "https://github.com/symfony/uid/tree/v7.1.0" }, "funding": [ { @@ -12570,20 +12572,20 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { "name": "symfony/var-dumper", - "version": "v7.0.7", + "version": "v7.1.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "d1627b66fd87c8b4d90cabe5671c29d575690924" + "reference": "595e4a4bc2118e7f4884315a684678b9403d44a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d1627b66fd87c8b4d90cabe5671c29d575690924", - "reference": "d1627b66fd87c8b4d90cabe5671c29d575690924", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/595e4a4bc2118e7f4884315a684678b9403d44a6", + "reference": "595e4a4bc2118e7f4884315a684678b9403d44a6", "shasum": "" }, "require": { @@ -12637,7 +12639,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.0.7" + "source": "https://github.com/symfony/var-dumper/tree/v7.1.0" }, "funding": [ { @@ -12653,7 +12655,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:29:19+00:00" + "time": "2024-05-28T06:54:05+00:00" }, { "name": "symfony/var-exporter", @@ -13705,16 +13707,16 @@ }, { "name": "kitloong/laravel-migrations-generator", - "version": "v7.0.2", + "version": "v7.0.3", "source": { "type": "git", "url": "https://github.com/kitloong/laravel-migrations-generator.git", - "reference": "88532360173d33d0492e88feb5d4810e9db9c2ff" + "reference": "ca7d318e4922f276d2f862d22a2089bee8eb6921" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kitloong/laravel-migrations-generator/zipball/88532360173d33d0492e88feb5d4810e9db9c2ff", - "reference": "88532360173d33d0492e88feb5d4810e9db9c2ff", + "url": "https://api.github.com/repos/kitloong/laravel-migrations-generator/zipball/ca7d318e4922f276d2f862d22a2089bee8eb6921", + "reference": "ca7d318e4922f276d2f862d22a2089bee8eb6921", "shasum": "" }, "require": { @@ -13766,15 +13768,19 @@ ], "support": { "issues": "https://github.com/kitloong/laravel-migrations-generator/issues", - "source": "https://github.com/kitloong/laravel-migrations-generator/tree/v7.0.2" + "source": "https://github.com/kitloong/laravel-migrations-generator/tree/v7.0.3" }, "funding": [ { "url": "https://www.buymeacoffee.com/kitloong", - "type": "custom" + "type": "buy_me_a_coffee" + }, + { + "url": "https://github.com/kitloong", + "type": "github" } ], - "time": "2024-04-23T14:01:01+00:00" + "time": "2024-06-01T17:17:59+00:00" }, { "name": "mockery/mockery", diff --git a/graphql/schema.graphql b/graphql/schema.graphql index a68f99d0b..0cf3cc5bb 100755 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -28,4 +28,5 @@ scalar Null @scalar(class: "MLL\\GraphQLScalars\\NullScalar") #import schemas/Social/*.graphql #import schemas/ContentEngine/*.graphql #import schemas/Souk/*.graphql +#import schemas/ActionEngine/*.graphql #import schemas/Ecosystem/Admin/*.graphql diff --git a/graphql/schemas/ActionEngine/action.graphql b/graphql/schemas/ActionEngine/action.graphql new file mode 100644 index 000000000..7070d69d8 --- /dev/null +++ b/graphql/schemas/ActionEngine/action.graphql @@ -0,0 +1,30 @@ +type Action { + id: ID! + name: String! + slug: String! + description: String + icon: String + form_fields: Mixed + form_config: Mixed + is_active: Boolean! + is_published: Boolean! + collects_info: Boolean! + config: Mixed + parent: Action + children: [Action!] +} + +type CompanyAction { + id: ID! + action: Action! + company: Company! + name: String! + description: String + form_config: Mixed + status: String! + is_active: Boolean! + is_published: Boolean! + weight: Float! + parent: CompanyAction + children: [CompanyAction!] +} diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql new file mode 100644 index 000000000..90eff7c20 --- /dev/null +++ b/graphql/schemas/ActionEngine/task.graphql @@ -0,0 +1,27 @@ +type TaskList { + id: ID! + name: String! + company: Company! + config: Mixed + tasks: [TaskListItem!] @hasMany +} + +type TaskListItem { + id: ID! + name: String! + status: String! + due_date: Date + completed_date: Date + config: Mixed + action: CompanyAction! + weight: Float! +} + +extend type Query @guard { + leadTaskList (lead_id: ID!): [TaskList!]! + @paginate( + model: "Kanvas\\ActionEngine\\Tasks\\Models\\TaskList" + scopes: ["fromApp", "fromCompany"] + defaultCount: 25 + ) +} diff --git a/src/Domains/ActionEngine/Actions/Models/Action.php b/src/Domains/ActionEngine/Actions/Models/Action.php index d906fe831..1284edae2 100644 --- a/src/Domains/ActionEngine/Actions/Models/Action.php +++ b/src/Domains/ActionEngine/Actions/Models/Action.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Actions\Models; +namespace Kanvas\ActionEngine\Actions\Models; use Baka\Traits\UuidTrait; use Kanvas\ActionEngine\Models\BaseModel; diff --git a/src/Domains/ActionEngine/Actions/Models/CompanyAction.php b/src/Domains/ActionEngine/Actions/Models/CompanyAction.php index 7382c1b8e..0c0fcadc3 100644 --- a/src/Domains/ActionEngine/Actions/Models/CompanyAction.php +++ b/src/Domains/ActionEngine/Actions/Models/CompanyAction.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Actions\Models; +namespace Kanvas\ActionEngine\Actions\Models; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; diff --git a/src/Domains/ActionEngine/Engagegments/Models/Engagement.php b/src/Domains/ActionEngine/Engagegments/Models/Engagement.php index 9243fd69d..ca71465bc 100644 --- a/src/Domains/ActionEngine/Engagegments/Models/Engagement.php +++ b/src/Domains/ActionEngine/Engagegments/Models/Engagement.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Engagements\Models; +namespace Kanvas\ActionEngine\Engagements\Models; use Baka\Traits\UuidTrait; use Domains\ActionEngine\Actions\Models\CompanyAction; diff --git a/src/Domains/ActionEngine/Pipelines/Models/Pipeline.php b/src/Domains/ActionEngine/Pipelines/Models/Pipeline.php index 0bdb16d08..f9bb0a80a 100644 --- a/src/Domains/ActionEngine/Pipelines/Models/Pipeline.php +++ b/src/Domains/ActionEngine/Pipelines/Models/Pipeline.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Pipelines\Models; +namespace Kanvas\ActionEngine\Pipelines\Models; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\HasMany; diff --git a/src/Domains/ActionEngine/Pipelines/Models/PipelineStage.php b/src/Domains/ActionEngine/Pipelines/Models/PipelineStage.php index 00d28a0ef..7cc0016a4 100644 --- a/src/Domains/ActionEngine/Pipelines/Models/PipelineStage.php +++ b/src/Domains/ActionEngine/Pipelines/Models/PipelineStage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Pipelines\Models; +namespace Kanvas\ActionEngine\Pipelines\Models; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; diff --git a/src/Domains/ActionEngine/Pipelines/Models/PipelineStageMessage.php b/src/Domains/ActionEngine/Pipelines/Models/PipelineStageMessage.php index ed7c4ea89..2500c5eb7 100644 --- a/src/Domains/ActionEngine/Pipelines/Models/PipelineStageMessage.php +++ b/src/Domains/ActionEngine/Pipelines/Models/PipelineStageMessage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Pipelines\Models; +namespace Kanvas\ActionEngine\Pipelines\Models; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskList.php b/src/Domains/ActionEngine/Tasks/Models/TaskList.php index 51624faff..92a4ce621 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskList.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskList.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Tasks\Models; +namespace Kanvas\ActionEngine\Tasks\Models; use Baka\Traits\UuidTrait; +use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\ActionEngine\Models\BaseModel; /** @@ -24,4 +25,9 @@ class TaskList extends BaseModel protected $table = 'company_task_list'; protected $guarded = []; + + public function tasks(): HasMany + { + return $this->hasMany(TaskListItem::class, 'task_list_id')->orderBy('weight'); + } } diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php index c2c3a5729..6857d1cfd 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php @@ -2,10 +2,11 @@ declare(strict_types=1); -namespace Domains\ActionEngine\Tasks\Models; +namespace Kanvas\ActionEngine\Tasks\Models; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Kanvas\ActionEngine\Actions\Models\CompanyAction; use Kanvas\ActionEngine\Models\BaseModel; /** @@ -30,4 +31,9 @@ public function task(): BelongsTo { return $this->belongsTo(TaskList::class, 'task_list_id'); } + + public function action(): BelongsTo + { + return $this->belongsTo(CompanyAction::class, 'companies_action_id'); + } } diff --git a/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php b/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php index 002636dfe..05a18fe83 100644 --- a/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php +++ b/src/Domains/Connectors/Shopify/Workflows/Activities/CreateUserActivity.php @@ -56,7 +56,8 @@ public function execute(Users $user, Apps $app, array $params): array ]; $customer = $client->Customer->post($customer); - $shopifyUserKey = CustomFieldEnum::USER_SHOPIFY_ID->value . '-' . $app->getId(); + //$shopifyUserKey = CustomFieldEnum::USER_SHOPIFY_ID->value . '-' . $app->getId(); + $shopifyUserKey = CustomFieldEnum::USER_SHOPIFY_ID->value; $user->set($shopifyUserKey, $customer['id']); return [ From e6985d5e2440e9fdd46b0bfa345f4ff457890ecd Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 2 Jun 2024 23:21:18 -0400 Subject: [PATCH 007/140] refac: fix type --- src/Domains/ActionEngine/Engagegments/Models/Engagement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/ActionEngine/Engagegments/Models/Engagement.php b/src/Domains/ActionEngine/Engagegments/Models/Engagement.php index ca71465bc..6702190bd 100644 --- a/src/Domains/ActionEngine/Engagegments/Models/Engagement.php +++ b/src/Domains/ActionEngine/Engagegments/Models/Engagement.php @@ -5,8 +5,8 @@ namespace Kanvas\ActionEngine\Engagements\Models; use Baka\Traits\UuidTrait; -use Domains\ActionEngine\Actions\Models\CompanyAction; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Kanvas\ActionEngine\Actions\Models\CompanyAction; use Kanvas\ActionEngine\Models\BaseModel; use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Leads\Models\Lead; From b91c9b1997e1c43fc0ed705bd0bae60705a8dc36 Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 3 Jun 2024 08:41:30 -0400 Subject: [PATCH 008/140] feat: add cast --- src/Domains/ActionEngine/Tasks/Models/TaskList.php | 5 +++++ src/Domains/ActionEngine/Tasks/Models/TaskListItem.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskList.php b/src/Domains/ActionEngine/Tasks/Models/TaskList.php index 92a4ce621..747b1028f 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskList.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskList.php @@ -4,6 +4,7 @@ namespace Kanvas\ActionEngine\Tasks\Models; +use Baka\Casts\Json; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\ActionEngine\Models\BaseModel; @@ -25,6 +26,10 @@ class TaskList extends BaseModel protected $table = 'company_task_list'; protected $guarded = []; + + protected $casts = [ + 'config' => Json::class, + ]; public function tasks(): HasMany { diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php index 6857d1cfd..4c123e7de 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php @@ -4,6 +4,7 @@ namespace Kanvas\ActionEngine\Tasks\Models; +use Baka\Casts\Json; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Kanvas\ActionEngine\Actions\Models\CompanyAction; @@ -27,6 +28,10 @@ class TaskListItem extends BaseModel protected $table = 'company_task_list_items'; protected $guarded = []; + protected $casts = [ + 'config' => Json::class, + ]; + public function task(): BelongsTo { return $this->belongsTo(TaskList::class, 'task_list_id'); From e45c12f0071b49f403cffe17c49e9a2761afa2bc Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 3 Jun 2024 09:56:56 -0400 Subject: [PATCH 009/140] feat: add cast --- src/Domains/ActionEngine/Tasks/Models/TaskList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskList.php b/src/Domains/ActionEngine/Tasks/Models/TaskList.php index 747b1028f..6b1cd6e56 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskList.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskList.php @@ -26,7 +26,7 @@ class TaskList extends BaseModel protected $table = 'company_task_list'; protected $guarded = []; - + protected $casts = [ 'config' => Json::class, ]; From 6f1f2d902527adfd0c38b6668b0d5dd1b6fc27d7 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Tue, 4 Jun 2024 22:11:34 -0400 Subject: [PATCH 010/140] feat: tag --- .../Social/Mutations/Tags/TagsManagement.php | 67 +++++++ graphql/schemas/Social/tags.graphql | 47 +++++ .../Social/Tags/Actions/CreateTagAction.php | 26 +++ .../Social/Tags/DataTransferObjects/Tag.php | 23 +++ src/Domains/Social/Tags/Models/Tag.php | 22 +++ tests/GraphQL/Social/TagsTest.php | 187 ++++++++++++++++++ 6 files changed, 372 insertions(+) create mode 100644 app/GraphQL/Social/Mutations/Tags/TagsManagement.php create mode 100644 graphql/schemas/Social/tags.graphql create mode 100644 src/Domains/Social/Tags/Actions/CreateTagAction.php create mode 100644 src/Domains/Social/Tags/DataTransferObjects/Tag.php create mode 100644 src/Domains/Social/Tags/Models/Tag.php create mode 100644 tests/GraphQL/Social/TagsTest.php diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php new file mode 100644 index 000000000..5ad099cda --- /dev/null +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -0,0 +1,67 @@ +getId(); + + $app = UsersAssociatedApps::where('users_id', auth()->user()->getId()) + ->where('apps_id', $appId) + ->firstOrFail(); + + $request['input']['slug'] = key_exists('slug', $request['input']) ? $request['input']['slug'] : Str::slug($request['input']['name']); + $request['input']['app'] = $app->app; + $request['input']['user'] = auth()->user(); + $request['input']['company'] = auth()->user()->getCurrentCompany(); + + $dto = TagData::from($request['input']); + + return (new CreateTagAction($dto))->execute(); + } + + public function update(mixed $root, array $request): Tag + { + $tag = Tag::where('users_id', auth()->user()->getId()) + ->where('id', $request['id']) + ->firstOrFail(); + + $tag->update($request['input']); + + return $tag; + } + + public function delete(mixed $root, array $request): bool + { + $tag = Tag::where('users_id', auth()->user()->getId()) + ->where('id', $request['id']) + ->firstOrFail(); + + return $tag->delete(); + } + + public function follow(mixed $root, array $request): bool + { + $tag = Tag::find($request['id']); + $isFollowing = UsersFollowsRepository::isFollowing(auth()->user(), $tag); + if ($isFollowing) { + return (new UnFollowAction(auth()->user(), $tag))->execute(); + } else { + return (bool)(new FollowAction(auth()->user(), $tag))->execute(); + } + } +} diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql new file mode 100644 index 000000000..7fd062e45 --- /dev/null +++ b/graphql/schemas/Social/tags.graphql @@ -0,0 +1,47 @@ +input TagInput { + apps_id: ID + name: String! + slug: String + weight: Int +} + +type Tag { + id: ID! + apps: App! + users: User + name: String! + slug: String + weight: Int + created_at: String + updated_at: String +} + +extend type Mutation @guard { + createTag(input: TagInput!): Tag + @field( + resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@create" + ) + updateTag(id: ID!, input: TagInput!): Tag + @field( + resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@update" + ) + deleteTag(id: ID!): Boolean + @field( + resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@delete" + ) + followTag(id: ID!): Boolean + @field( + resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@follow" + ) +} + +extend type Query @guard { + tags( + where: _ @whereConditions(columns: ["id", "name", "slug", "weight"]) + orderBy: _ @orderBy(columns: ["id"]) + ): [Tag!]! + @paginate( + model: "Kanvas\\Social\\Tags\\Models\\Tag" + scopes: ["fromApp"] + ) +} diff --git a/src/Domains/Social/Tags/Actions/CreateTagAction.php b/src/Domains/Social/Tags/Actions/CreateTagAction.php new file mode 100644 index 000000000..979727bc3 --- /dev/null +++ b/src/Domains/Social/Tags/Actions/CreateTagAction.php @@ -0,0 +1,26 @@ + $this->tagData->app->getId(), + 'users_id' => $this->tagData->user?->getId(), + 'companies_id' => $this->tagData->company->getId(), + 'name' => $this->tagData->name, + 'slug' => $this->tagData->slug, + 'weight' => $this->tagData->weight, + ]); + } +} \ No newline at end of file diff --git a/src/Domains/Social/Tags/DataTransferObjects/Tag.php b/src/Domains/Social/Tags/DataTransferObjects/Tag.php new file mode 100644 index 000000000..373edb6ff --- /dev/null +++ b/src/Domains/Social/Tags/DataTransferObjects/Tag.php @@ -0,0 +1,23 @@ + fake()->name(), + 'slug' => Str::slug(fake()->name()), + 'weight' => random_int(1, 100), + ]; + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + )->assertJson([ + 'data' => [ + 'createTag' => $input, + ], + ]); + } + + public function testUpdateTag() + { + $input = [ + 'name' => fake()->name(), + 'slug' => Str::slug(fake()->name()), + 'weight' => random_int(1, 100), + ]; + $response = $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + ); + $tag = $response->json('data.createTag'); + $input['name'] = fake()->name(); + $input['slug'] = Str::slug(fake()->name()); + $input['weight'] = random_int(1, 100); + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation updateTag( + $id: ID! + $input: TagInput! + ) + { + updateTag(id: $id, input: $input) { + id + name + slug + weight + } + } + ', + [ + 'id' => $tag['id'], + 'input' => $input, + ] + )->assertJson([ + 'data' => [ + 'updateTag' => $input, + ], + ]); + } + + public function testDeleteTag() + { + $input = [ + 'name' => fake()->name(), + 'slug' => Str::slug(fake()->name()), + 'weight' => random_int(1, 100), + ]; + $response = $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + ); + $tag = $response->json('data.createTag'); + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation deleteTag( + $id: ID! + ) + { + deleteTag(id: $id) + } + ', + [ + 'id' => $tag['id'], + ] + )->assertJson([ + 'data' => [ + 'deleteTag' => true, + ], + ]); + } + + public function testFollowTag() + { + $input = [ + 'name' => fake()->name(), + 'slug' => Str::slug(fake()->name()), + 'weight' => random_int(1, 100), + ]; + $response = $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + ); + $tag = $response->json('data.createTag'); + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation followTag( + $tag_id: ID! + ) + { + followTag(id: $tag_id) + } + ', + [ + 'tag_id' => $tag['id'], + ] + )->assertJson([ + 'data' => [ + 'followTag' => true, + ], + ]); + } +} From a4fdb4d2aee7f88b2481380ea1810b316781f41d Mon Sep 17 00:00:00 2001 From: FredPeal Date: Tue, 4 Jun 2024 22:22:27 -0400 Subject: [PATCH 011/140] refactor: add index --- .../migrations/2024_05_31_045942_request_deleted_account.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php index f60333f65..34a5337b1 100644 --- a/database/migrations/2024_05_31_045942_request_deleted_account.php +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -19,6 +19,8 @@ public function up(): void $table->dateTime('request_date'); $table->integer('is_deleted')->default(0); $table->timestamps(); + $table->index(['apps_id', 'users_id', 'request_date']); + }); } From 5b426b9124a5e6510fc7c62b6b34f79bf5e09989 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Wed, 5 Jun 2024 00:27:32 -0400 Subject: [PATCH 012/140] refactor: schedule command --- .../Commands/DeleteUsersRequestedCommand.php | 15 +++++++++------ app/Console/Kernel.php | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/DeleteUsersRequestedCommand.php b/app/Console/Commands/DeleteUsersRequestedCommand.php index 475177228..2bf81c38d 100644 --- a/app/Console/Commands/DeleteUsersRequestedCommand.php +++ b/app/Console/Commands/DeleteUsersRequestedCommand.php @@ -33,12 +33,15 @@ class DeleteUsersRequestedCommand extends Command */ public function handle() { - $this->info('Deleting user'); - $appsId = $this->argument('apps_id') ?? 1; - $app = Apps::find($appsId); - $days = $app->get('days_to_delete') ?? 30; - $users = RequestDeletedAccount::where('apps_id', $app->getId()) - ->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) + $appsId = $this->argument('apps_id'); + if($appsId){ + $app = Apps::findFirstOrFail($appsId); + $this->info('Deleting user from app: ' . $app->name); + } + $days = $appsId ? $app->get('days_to_delete') : 30; + $users = RequestDeletedAccount::when($appsId, function ($query) use ($appsId) { + return $query->where('apps_id', $appsId); + })->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) ->where('is_deleted', 0) ->get(); foreach ($users as $user) { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b8e80aedb..a16608d57 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -7,6 +7,7 @@ use Spatie\Health\Commands\DispatchQueueCheckJobsCommand; use Spatie\Health\Commands\RunHealthChecksCommand; use Spatie\Health\Commands\ScheduleCheckHeartbeatCommand; +use App\Console\Commands\DeleteUsersRequestedCommand; class Kernel extends ConsoleKernel { @@ -20,6 +21,7 @@ protected function schedule(Schedule $schedule) $schedule->command(RunHealthChecksCommand::class)->everyMinute(); $schedule->command(DispatchQueueCheckJobsCommand::class)->everyMinute(); $schedule->command(ScheduleCheckHeartbeatCommand::class)->everyMinute(); + $schedule->command(DeleteUsersRequestedCommand::class)->dailyAt('00:00'); /* $schedule->command(MailCaddieLabCommand::class, [getenv('CADDIE_APP_KEY')]) ->dailyAt('13:00') ->timezone('America/Santo_Domingo') ; */ From abdd29bd4d17a555265bc9ce9180d07a41645313 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 5 Jun 2024 06:06:47 +0000 Subject: [PATCH 013/140] Apply fixes from StyleCI --- app/Console/Commands/DeleteUsersRequestedCommand.php | 6 +++--- .../2024_05_31_045942_request_deleted_account.php | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/DeleteUsersRequestedCommand.php b/app/Console/Commands/DeleteUsersRequestedCommand.php index 2bf81c38d..d54dea2aa 100644 --- a/app/Console/Commands/DeleteUsersRequestedCommand.php +++ b/app/Console/Commands/DeleteUsersRequestedCommand.php @@ -34,14 +34,14 @@ class DeleteUsersRequestedCommand extends Command public function handle() { $appsId = $this->argument('apps_id'); - if($appsId){ + if ($appsId) { $app = Apps::findFirstOrFail($appsId); $this->info('Deleting user from app: ' . $app->name); } $days = $appsId ? $app->get('days_to_delete') : 30; $users = RequestDeletedAccount::when($appsId, function ($query) use ($appsId) { - return $query->where('apps_id', $appsId); - })->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) + return $query->where('apps_id', $appsId); + })->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) ->where('is_deleted', 0) ->get(); foreach ($users as $user) { diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php index 34a5337b1..9ef2acdf7 100644 --- a/database/migrations/2024_05_31_045942_request_deleted_account.php +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -20,7 +20,6 @@ public function up(): void $table->integer('is_deleted')->default(0); $table->timestamps(); $table->index(['apps_id', 'users_id', 'request_date']); - }); } From a1ccbf8613acfb2ca9d62caf8a12e9486c3d8f97 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 5 Jun 2024 06:50:45 +0000 Subject: [PATCH 014/140] Apply fixes from StyleCI --- src/Domains/Social/Tags/Actions/CreateTagAction.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Domains/Social/Tags/Actions/CreateTagAction.php b/src/Domains/Social/Tags/Actions/CreateTagAction.php index 979727bc3..8839c04d8 100644 --- a/src/Domains/Social/Tags/Actions/CreateTagAction.php +++ b/src/Domains/Social/Tags/Actions/CreateTagAction.php @@ -1,4 +1,5 @@ $this->tagData->weight, ]); } -} \ No newline at end of file +} From 6c80faa006d2c34a5beb849bd34e4cc83cfd0ece Mon Sep 17 00:00:00 2001 From: FredPeal Date: Wed, 5 Jun 2024 13:37:22 -0400 Subject: [PATCH 015/140] refactor: use pivot for attach tags --- .../Social/Mutations/Tags/TagsManagement.php | 33 ++++-- .../2024_06_05_154618_tags_entities.php | 36 ++++++ .../2024_06_05_172750_taggable_type.php | 28 +++++ database/seeders/SystemModuleSeeder.php | 2 +- graphql/schemas/Social/tags.graphql | 14 ++- .../Social/Tags/DataTransferObjects/Tag.php | 2 +- src/Domains/Social/Tags/Models/Tag.php | 15 +++ src/Domains/Social/Tags/Models/TagEntity.php | 27 +++++ tests/GraphQL/Social/TagsTest.php | 111 ++++++++++++++++++ 9 files changed, 253 insertions(+), 15 deletions(-) create mode 100644 database/migrations/Social/2024_06_05_154618_tags_entities.php create mode 100644 database/migrations/Social/2024_06_05_172750_taggable_type.php create mode 100644 src/Domains/Social/Tags/Models/TagEntity.php diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 5ad099cda..23b89e6ed 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -4,7 +4,6 @@ namespace App\GraphQL\Social\Mutations\Tags; -use Baka\Support\Str; use Kanvas\Apps\Models\Apps; use Kanvas\Social\Follows\Actions\FollowAction; use Kanvas\Social\Follows\Actions\UnFollowAction; @@ -12,20 +11,13 @@ use Kanvas\Social\Tags\Actions\CreateTagAction; use Kanvas\Social\Tags\DataTransferObjects\Tag as TagData; use Kanvas\Social\Tags\Models\Tag; -use Kanvas\Users\Models\UsersAssociatedApps; +use Kanvas\SystemModules\Repositories\SystemModulesRepository; class TagsManagement { public function create(mixed $root, array $request): Tag { - $appId = key_exists('apps_id', $request['input']) ? $request['input']['apps_id'] : app(Apps::class)->getId(); - - $app = UsersAssociatedApps::where('users_id', auth()->user()->getId()) - ->where('apps_id', $appId) - ->firstOrFail(); - - $request['input']['slug'] = key_exists('slug', $request['input']) ? $request['input']['slug'] : Str::slug($request['input']['name']); - $request['input']['app'] = $app->app; + $request['input']['app'] = app(Apps::class); $request['input']['user'] = auth()->user(); $request['input']['company'] = auth()->user()->getCurrentCompany(); @@ -64,4 +56,25 @@ public function follow(mixed $root, array $request): bool return (bool)(new FollowAction(auth()->user(), $tag))->execute(); } } + + public function attachTagToEntity(mixed $root, array $request): bool + { + $tag = Tag::where('users_id', auth()->user()->getId()) + ->where('id', $request['input']['tag_id']) + ->firstOrFail(); + + $systemModule = SystemModulesRepository::getByName($request['input']['system_module_name']); + + $entity = $systemModule->model_name::find((int)$request['input']['entity_id']); + + $tag->entities()->attach($entity->getId(), [ + 'entity_namespace' => $systemModule->model_name, + 'apps_id' => $tag->apps_id, + 'companies_id' => auth()->user()->getCurrentCompany()->getId(), + 'users_id' => auth()->user()->getId(), + 'taggable_type' => $systemModule->model_name, + ]); + + return true; + } } diff --git a/database/migrations/Social/2024_06_05_154618_tags_entities.php b/database/migrations/Social/2024_06_05_154618_tags_entities.php new file mode 100644 index 000000000..2ca135e8a --- /dev/null +++ b/database/migrations/Social/2024_06_05_154618_tags_entities.php @@ -0,0 +1,36 @@ +id(); + $table->integer('tags_id')->index('tags_id'); + $table->integer('entity_id')->index('entity_id'); + $table->string('entity_namespace')->index('entity_namespace'); + $table->integer('companies_id')->index('companies_id'); + $table->integer('apps_id')->index('apps_id'); + $table->integer('users_id'); + $table->boolean('is_deleted')->default(0); + $table->timestamp('created_at')->index('created_at')->useCurrent(); + $table->datetime('updated_at')->nullable()->index('updated_at'); + $table->index(['tags_id', 'entity_id', 'companies_id', 'apps_id', 'is_deleted'], 'tags_entities_index'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('tags_entities'); + } +}; diff --git a/database/migrations/Social/2024_06_05_172750_taggable_type.php b/database/migrations/Social/2024_06_05_172750_taggable_type.php new file mode 100644 index 000000000..86f0b8410 --- /dev/null +++ b/database/migrations/Social/2024_06_05_172750_taggable_type.php @@ -0,0 +1,28 @@ +string('taggable_type')->nullable()->after('entity_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tags_entities', function (Blueprint $table) { + $table->dropColumn('taggable_type'); + }); + } +}; diff --git a/database/seeders/SystemModuleSeeder.php b/database/seeders/SystemModuleSeeder.php index 871be5015..95fa17ac5 100755 --- a/database/seeders/SystemModuleSeeder.php +++ b/database/seeders/SystemModuleSeeder.php @@ -20,7 +20,7 @@ public function run() [ 'name' => 'Companies', 'slug' => 'companies', - 'model_name' => 'Kanvas\\Models\\Companies', + 'model_name' => 'Kanvas\\Companies\\Models\\Companies', 'uuid' => (string) Str::uuid(), 'apps_id' => '1', 'parents_id' => '0', diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql index 7fd062e45..5936f01fa 100644 --- a/graphql/schemas/Social/tags.graphql +++ b/graphql/schemas/Social/tags.graphql @@ -1,5 +1,4 @@ input TagInput { - apps_id: ID name: String! slug: String weight: Int @@ -7,8 +6,7 @@ input TagInput { type Tag { id: ID! - apps: App! - users: User + users: User! name: String! slug: String weight: Int @@ -16,6 +14,12 @@ type Tag { updated_at: String } +input AttachTagEntityInput { + entity_id: ID! + tag_id: ID! + system_module_name: String! +} + extend type Mutation @guard { createTag(input: TagInput!): Tag @field( @@ -33,6 +37,10 @@ extend type Mutation @guard { @field( resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@follow" ) + attachTagToEntity(input: AttachTagEntityInput!): Boolean + @field( + resolver: "App\\GraphQL\\Social\\Mutations\\Tags\\TagsManagement@attachTagToEntity" + ) } extend type Query @guard { diff --git a/src/Domains/Social/Tags/DataTransferObjects/Tag.php b/src/Domains/Social/Tags/DataTransferObjects/Tag.php index 373edb6ff..26578b56e 100644 --- a/src/Domains/Social/Tags/DataTransferObjects/Tag.php +++ b/src/Domains/Social/Tags/DataTransferObjects/Tag.php @@ -16,7 +16,7 @@ public function __construct( public Users $user, public Companies $company, public string $name, - public string $slug, + public ?string $slug = null, public ?int $weight = null ) { } diff --git a/src/Domains/Social/Tags/Models/Tag.php b/src/Domains/Social/Tags/Models/Tag.php index e6a095f06..96330dc8f 100644 --- a/src/Domains/Social/Tags/Models/Tag.php +++ b/src/Domains/Social/Tags/Models/Tag.php @@ -5,6 +5,7 @@ namespace Kanvas\Social\Tags\Models; use Kanvas\Social\Models\BaseModel; +use Baka\Traits\SlugTrait; /** * @property int id @@ -18,5 +19,19 @@ */ class Tag extends BaseModel { + use SlugTrait; + protected $guarded = []; + + public function taggables() + { + return $this->hasMany(TagEntity::class); + } + + public function entities() + { + return $this->morphToMany(Tag::class, 'taggable', 'tags_entities', 'tags_id', 'entity_id') + ->using(TagEntity::class) + ->withPivot('entity_namespace', 'companies_id', 'apps_id', 'users_id', 'is_deleted', 'created_at', 'updated_at'); + } } diff --git a/src/Domains/Social/Tags/Models/TagEntity.php b/src/Domains/Social/Tags/Models/TagEntity.php new file mode 100644 index 000000000..16aa08231 --- /dev/null +++ b/src/Domains/Social/Tags/Models/TagEntity.php @@ -0,0 +1,27 @@ +morphTo(null, 'entity_namespace', 'entity_id'); + } +} diff --git a/tests/GraphQL/Social/TagsTest.php b/tests/GraphQL/Social/TagsTest.php index 8532305d4..5f2127081 100644 --- a/tests/GraphQL/Social/TagsTest.php +++ b/tests/GraphQL/Social/TagsTest.php @@ -5,6 +5,9 @@ namespace Tests\GraphQL\Social; use Baka\Support\Str; +use Kanvas\Social\Messages\Models\Message; +use Kanvas\Social\MessagesTypes\Models\MessageType; +use Kanvas\SystemModules\Models\SystemModules; use Tests\TestCase; class TagsTest extends TestCase @@ -40,6 +43,36 @@ public function testCreateTag() ]); } + public function testCreateTagWithoutSlug() + { + $input = [ + 'name' => fake()->name(), + 'weight' => random_int(1, 100), + ]; + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + )->assertJson([ + 'data' => [ + 'createTag' => $input, + ], + ]); + } + public function testUpdateTag() { $input = [ @@ -184,4 +217,82 @@ public function testFollowTag() ], ]); } + + public function testAttachTagToMessage() + { + + $messageType = MessageType::factory()->create(); + $message = fake()->text(); + Message::makeAllSearchable(); + + $response = $this->graphQL( + ' + mutation createMessage($input: MessageInput!) { + createMessage(input: $input) { + id + message + } + } + ', + [ + 'input' => [ + 'message' => $message, + 'message_verb' => $messageType->verb, + 'system_modules_id' => 1, + 'entity_id' => '1', + ], + ] + ); + $systemModule = SystemModules::find(1); + + $message = $response->json('data.createMessage'); + + $input = [ + 'name' => fake()->name(), + 'slug' => Str::slug(fake()->name()), + 'weight' => random_int(1, 100), + ]; + + $response = $this->graphQL(/** @lang GRAPHQL */ + ' + mutation createTag( + $input: TagInput! + ) + { + createTag(input: $input) { + id + name + slug + weight + } + } + ', + [ + 'input' => $input, + ] + ); + $tag = $response->json('data.createTag'); + $attach = [ + 'tag_id' => $tag['id'], + 'system_module_name' => $systemModule->name, + 'entity_id' => $message['id'], + ]; + $this->graphQL(/** @lang GRAPHQL */ + ' + mutation attachTagToEntity( + $input: AttachTagEntityInput! + ) + { + attachTagToEntity(input: $input) + } + ', + [ + 'input' => $attach, + ] + )->assertJson([ + 'data' => [ + 'attachTagToEntity' => true, + ], + ]); + } } From fc0434ab7835db7c13104332540d93fd594507a0 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 6 Jun 2024 11:16:02 -0400 Subject: [PATCH 016/140] refactor: add TagTest --- graphql/schemas/Social/tags.graphql | 11 +++++++ src/Domains/Social/Tags/Models/Tag.php | 2 +- tests/GraphQL/Social/TagsTest.php | 44 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql index 5936f01fa..7f8b23352 100644 --- a/graphql/schemas/Social/tags.graphql +++ b/graphql/schemas/Social/tags.graphql @@ -12,6 +12,16 @@ type Tag { weight: Int created_at: String updated_at: String + taggables: [TagEntity!]! @hasMany(method: "taggables") +} + +type TagEntity { + id: ID! + entity_id: ID! + tags_id: ID! + system_module_name: String! + created_at: String + updated_at: String } input AttachTagEntityInput { @@ -51,5 +61,6 @@ extend type Query @guard { @paginate( model: "Kanvas\\Social\\Tags\\Models\\Tag" scopes: ["fromApp"] + defaultCount: 15 ) } diff --git a/src/Domains/Social/Tags/Models/Tag.php b/src/Domains/Social/Tags/Models/Tag.php index 96330dc8f..be4da05dc 100644 --- a/src/Domains/Social/Tags/Models/Tag.php +++ b/src/Domains/Social/Tags/Models/Tag.php @@ -25,7 +25,7 @@ class Tag extends BaseModel public function taggables() { - return $this->hasMany(TagEntity::class); + return $this->hasMany(TagEntity::class, 'tags_id'); } public function entities() diff --git a/tests/GraphQL/Social/TagsTest.php b/tests/GraphQL/Social/TagsTest.php index 5f2127081..1ea447ef7 100644 --- a/tests/GraphQL/Social/TagsTest.php +++ b/tests/GraphQL/Social/TagsTest.php @@ -294,5 +294,49 @@ public function testAttachTagToMessage() 'attachTagToEntity' => true, ], ]); + + $this->graphQL(' + query tag( + $where: QueryTagsWhereWhereConditions + ){ + tags(where: $where) { + data { + id + name + slug + weight + taggables { + tags_id + entity_id + } + } + } + } + ', [ + 'where' => [ + 'value' => $tag['id'], + 'column' => 'ID', + 'operator' => 'EQ', + ], + ])->assertJson([ + 'data' => [ + 'tags' => [ + 'data' => [ + [ + 'id' => $tag['id'], + 'name' => $input['name'], + 'slug' => $input['slug'], + 'weight' => $input['weight'], + 'taggables' => [ + [ + 'tags_id' => $tag['id'], + 'entity_id' => $message['id'], + ], + ], + ], + ], + ], + ], + ]); } } From c06f51fbef0f45f6dc084cac20b7c817bfc49035 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 6 Jun 2024 11:18:59 -0400 Subject: [PATCH 017/140] refactor: add index --- .../migrations/2024_05_31_045942_request_deleted_account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php index 9ef2acdf7..212a257c7 100644 --- a/database/migrations/2024_05_31_045942_request_deleted_account.php +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -14,9 +14,9 @@ public function up(): void $table->id(); $table->bigInteger('apps_id')->unsigned(); $table->bigInteger('users_id')->unsigned(); - $table->string('email'); + $table->string('email')->index('email'); $table->string('reason')->nullable(); - $table->dateTime('request_date'); + $table->dateTime('request_date')->index('request_date'); $table->integer('is_deleted')->default(0); $table->timestamps(); $table->index(['apps_id', 'users_id', 'request_date']); From 5b809c688cb35059688ef6579d2597c1fa547adb Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 6 Jun 2024 12:28:36 -0400 Subject: [PATCH 018/140] refactor: index apps_id and users_id --- ...24_05_31_045942_request_deleted_account.php | 4 ++-- .../Sessions/Observers/SessionObserver.php | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 src/Kanvas/Sessions/Observers/SessionObserver.php diff --git a/database/migrations/2024_05_31_045942_request_deleted_account.php b/database/migrations/2024_05_31_045942_request_deleted_account.php index 212a257c7..3e4fb6d00 100644 --- a/database/migrations/2024_05_31_045942_request_deleted_account.php +++ b/database/migrations/2024_05_31_045942_request_deleted_account.php @@ -12,8 +12,8 @@ public function up(): void { Schema::create('request_deleted_accounts', function (Blueprint $table) { $table->id(); - $table->bigInteger('apps_id')->unsigned(); - $table->bigInteger('users_id')->unsigned(); + $table->bigInteger('apps_id')->unsigned()->index('apps_id'); + $table->bigInteger('users_id')->unsigned()->index('users_id'); $table->string('email')->index('email'); $table->string('reason')->nullable(); $table->dateTime('request_date')->index('request_date'); diff --git a/src/Kanvas/Sessions/Observers/SessionObserver.php b/src/Kanvas/Sessions/Observers/SessionObserver.php deleted file mode 100644 index 2944cea2e..000000000 --- a/src/Kanvas/Sessions/Observers/SessionObserver.php +++ /dev/null @@ -1,18 +0,0 @@ -users_id) - ->where('apps_id', $session->apps_id) - ->update(['is_deleted' => 1]); - } -} From 5389b8c39e5e2f424f35ea451cddaf1e14de934a Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 6 Jun 2024 16:38:37 +0000 Subject: [PATCH 019/140] Apply fixes from StyleCI --- database/migrations/Social/2024_06_05_154618_tags_entities.php | 3 +-- database/migrations/Social/2024_06_05_172750_taggable_type.php | 3 +-- tests/GraphQL/Social/TagsTest.php | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/database/migrations/Social/2024_06_05_154618_tags_entities.php b/database/migrations/Social/2024_06_05_154618_tags_entities.php index 2ca135e8a..719c97a27 100644 --- a/database/migrations/Social/2024_06_05_154618_tags_entities.php +++ b/database/migrations/Social/2024_06_05_154618_tags_entities.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class () extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/Social/2024_06_05_172750_taggable_type.php b/database/migrations/Social/2024_06_05_172750_taggable_type.php index 86f0b8410..69d5093c0 100644 --- a/database/migrations/Social/2024_06_05_172750_taggable_type.php +++ b/database/migrations/Social/2024_06_05_172750_taggable_type.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class () extends Migration { /** * Run the migrations. */ diff --git a/tests/GraphQL/Social/TagsTest.php b/tests/GraphQL/Social/TagsTest.php index 1ea447ef7..25dff8860 100644 --- a/tests/GraphQL/Social/TagsTest.php +++ b/tests/GraphQL/Social/TagsTest.php @@ -220,7 +220,6 @@ public function testFollowTag() public function testAttachTagToMessage() { - $messageType = MessageType::factory()->create(); $message = fake()->text(); Message::makeAllSearchable(); From 23f58063864a2c59141061ecb0d0e2b6fba40573 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 6 Jun 2024 12:45:54 -0400 Subject: [PATCH 020/140] refactor: remove session from event service providers --- app/Providers/EventServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 7bcd99f73..8dc3fed64 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -81,7 +81,6 @@ public function boot() UsersAssociatedApps::observe(UsersAssociatedAppsObserver::class); UserCompanyApps::observe(UsersAssociatedCompaniesObserver::class); ProductsCategories::observe(ProductsCategoriesObserver::class); - Sessions::observe(SessionObserver::class); } /** From c42a52ee7d9ca8b52f9abee262bcbe2e5f8532ff Mon Sep 17 00:00:00 2001 From: Rafael White Date: Thu, 6 Jun 2024 13:03:30 -0400 Subject: [PATCH 021/140] add docker compose file for development deploys --- docker-compose.dev.yml | 98 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 docker-compose.dev.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 000000000..213af36cd --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,98 @@ +services: + php: + container_name: php${APP_CONTAINER_NAME} + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + # command: ["sh", "-c", "php artisan lighthouse:cache && php artisan config:cache"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue: + container_name: queue + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue-social: + container_name: queue-social + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue kanvas-social --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue-notifications: + container_name: queue-notifications + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue notifications --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + 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 +networks: + sail: + driver: bridge From cc3ca70a0d449f979368a663d072f40ffb5b3dcb Mon Sep 17 00:00:00 2001 From: Rafael White Date: Thu, 6 Jun 2024 16:16:29 -0400 Subject: [PATCH 022/140] add composer install in dockerfile --- development.Dockerfile | 4 ++-- docker-compose.dev.yml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/development.Dockerfile b/development.Dockerfile index a96eff554..e078417c3 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -40,8 +40,6 @@ COPY . /app # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --optimize-autoloader - # add root to www group # RUN chmod -R ug+w var/www/html/storage @@ -52,4 +50,6 @@ RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini WORKDIR /var/www/html/ +RUN composer install --optimize-autoloader + EXPOSE 8080 \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 213af36cd..8cc1c0fc6 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -93,6 +93,19 @@ services: test: ["CMD", "service", "nginx", "status"] retries: 3 timeout: 5s + redis: + container_name: redis${APP_CONTAINER_NAME} + image: 'redis:alpine' + ports: + - '${FORWARD_REDIS_PORT:-6379}:6379' + volumes: + - 'sail-redis:/data' + networks: + - sail + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + retries: 3 + timeout: 5s networks: sail: driver: bridge From 754ee30d70a394ab6b4750683d83cd4c2396c34c Mon Sep 17 00:00:00 2001 From: Rafael White Date: Thu, 6 Jun 2024 16:21:19 -0400 Subject: [PATCH 023/140] add redis volume --- docker-compose.dev.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 8cc1c0fc6..ddf70f215 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -109,3 +109,6 @@ services: networks: sail: driver: bridge +volumes: + sail-redis: + driver: local From 1a0d004293089bb0e475a3a81c5aab8abdf52ba9 Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 6 Jun 2024 17:43:44 -0400 Subject: [PATCH 024/140] refact: fix msg --- .../Notifications/MailCaddieLabCommand.php | 17 +++++++++++++++-- .../Auth/Socialite/Drivers/GoogleDriver.php | 6 ++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/Connectors/Notifications/MailCaddieLabCommand.php b/app/Console/Commands/Connectors/Notifications/MailCaddieLabCommand.php index d62874f53..e54c31b51 100644 --- a/app/Console/Commands/Connectors/Notifications/MailCaddieLabCommand.php +++ b/app/Console/Commands/Connectors/Notifications/MailCaddieLabCommand.php @@ -5,6 +5,7 @@ use Illuminate\Console\Command; use Kanvas\Apps\Repositories\AppsRepository; use Kanvas\Connectors\Notifications\Jobs\MailCaddieLabJob; +use Kanvas\Guild\Customers\Repositories\PeoplesRepository; class MailCaddieLabCommand extends Command { @@ -13,9 +14,21 @@ class MailCaddieLabCommand extends Command public function handle() { $this->info('Sending internal mail to Caddie Lab'); - //dump($this->argument('email')); + $app = AppsRepository::findFirstByKey($this->argument('apps_id')); $email = $this->argument('email'); - MailCaddieLabJob::dispatch($app, $email); + + $peoplesIn7Days = PeoplesRepository::getByDaysCreated(7, $app); + $peoplesIn28Days = PeoplesRepository::getByDaysCreated(28, $app); + + $this->info('We will be sending email to ' . count($peoplesIn7Days) . ' people that have been created in the last 7 days'); + $this->info('We will be sending email to ' . count($peoplesIn28Days) . ' people that have been created in the last 28 days'); + + if ($this->confirm('Are you sure you want to send this email?')) { + MailCaddieLabJob::dispatch($app, $email); + $this->info('Emails have been dispatched.'); + } else { + $this->info('Email sending has been canceled.'); + } } } diff --git a/src/Kanvas/Auth/Socialite/Drivers/GoogleDriver.php b/src/Kanvas/Auth/Socialite/Drivers/GoogleDriver.php index fd531ec3d..db9fcdb50 100644 --- a/src/Kanvas/Auth/Socialite/Drivers/GoogleDriver.php +++ b/src/Kanvas/Auth/Socialite/Drivers/GoogleDriver.php @@ -9,6 +9,7 @@ use Kanvas\Auth\Exceptions\AuthenticationException; use Kanvas\Auth\Socialite\Contracts\DriverInterface; use Kanvas\Auth\Socialite\DataTransferObject\User; +use Kanvas\Exceptions\ValidationException; class GoogleDriver implements DriverInterface { @@ -17,6 +18,11 @@ class GoogleDriver implements DriverInterface public function __construct(protected array $config) { $this->client = new Google_Client(); + + if (! isset($this->config['client_id']) || ! isset($this->config['client_secret']) || ! isset($this->config['redirect_uri'])) { + throw new ValidationException('Missing google client_id, client_secret or redirect_uri'); + } + $this->client->setClientId($this->config['client_id']); $this->client->setClientSecret($this->config['client_secret']); $this->client->setRedirectUri($this->config['redirect_uri']); From 1ec3e28b676c215fb7f78dcbdfd390d8915cc349 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 6 Jun 2024 17:57:22 -0400 Subject: [PATCH 025/140] refactor: if user is not admin check if user is owner --- app/GraphQL/Social/Mutations/Tags/TagsManagement.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 23b89e6ed..3861515c3 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -28,8 +28,9 @@ public function create(mixed $root, array $request): Tag public function update(mixed $root, array $request): Tag { - $tag = Tag::where('users_id', auth()->user()->getId()) - ->where('id', $request['id']) + $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { + return $query->where('users_id', auth()->user()->getId()); + })->where('id', $request['id']) ->firstOrFail(); $tag->update($request['input']); @@ -39,10 +40,13 @@ public function update(mixed $root, array $request): Tag public function delete(mixed $root, array $request): bool { - $tag = Tag::where('users_id', auth()->user()->getId()) + $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { + return $query->where('users_id', auth()->user()->getId()); + }) ->where('id', $request['id']) ->firstOrFail(); + return $tag->delete(); } From 631afaaad7b07f00034ed790052bf7f7051f05f4 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 6 Jun 2024 22:15:15 +0000 Subject: [PATCH 026/140] Apply fixes from StyleCI --- app/GraphQL/Social/Mutations/Tags/TagsManagement.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 3861515c3..516db9d3b 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -29,8 +29,8 @@ public function create(mixed $root, array $request): Tag public function update(mixed $root, array $request): Tag { $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { - return $query->where('users_id', auth()->user()->getId()); - })->where('id', $request['id']) + return $query->where('users_id', auth()->user()->getId()); + })->where('id', $request['id']) ->firstOrFail(); $tag->update($request['input']); @@ -41,8 +41,8 @@ public function update(mixed $root, array $request): Tag public function delete(mixed $root, array $request): bool { $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { - return $query->where('users_id', auth()->user()->getId()); - }) + return $query->where('users_id', auth()->user()->getId()); + }) ->where('id', $request['id']) ->firstOrFail(); From d7f91e5c46e7fcb387b75c4b22497f2dc075dd00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:42:36 +0000 Subject: [PATCH 027/140] build(deps): bump twilio/sdk from 8.1.0 to 8.1.1 Bumps [twilio/sdk](https://github.com/twilio/twilio-php) from 8.1.0 to 8.1.1. - [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.1.0...8.1.1) --- updated-dependencies: - dependency-name: twilio/sdk 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 2f3fde0b8..b97deeeb8 100644 --- a/composer.lock +++ b/composer.lock @@ -12991,16 +12991,16 @@ }, { "name": "twilio/sdk", - "version": "8.1.0", + "version": "8.1.1", "source": { "type": "git", "url": "https://github.com/twilio/twilio-php.git", - "reference": "547e6ceca9a1491a645065f344ddb592a3456298" + "reference": "d59f57a548e2659fb305be11690b7b0aaf40a84c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twilio/twilio-php/zipball/547e6ceca9a1491a645065f344ddb592a3456298", - "reference": "547e6ceca9a1491a645065f344ddb592a3456298", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/d59f57a548e2659fb305be11690b7b0aaf40a84c", + "reference": "d59f57a548e2659fb305be11690b7b0aaf40a84c", "shasum": "" }, "require": { @@ -13038,9 +13038,9 @@ ], "support": { "issues": "https://github.com/twilio/twilio-php/issues", - "source": "https://github.com/twilio/twilio-php/tree/8.1.0" + "source": "https://github.com/twilio/twilio-php/tree/8.1.1" }, - "time": "2024-05-24T11:10:19+00:00" + "time": "2024-06-06T11:46:47+00:00" }, { "name": "vladimir-yuldashev/laravel-queue-rabbitmq", From 3935866eed7fd21371b25a6b9b8bc00154365435 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 22:42:44 +0000 Subject: [PATCH 028/140] build(deps-dev): bump phpstan/phpstan from 1.11.3 to 1.11.4 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.3 to 1.11.4. - [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.3...1.11.4) --- 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 2f3fde0b8..ec5380424 100644 --- a/composer.lock +++ b/composer.lock @@ -14141,16 +14141,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.3", + "version": "1.11.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", "shasum": "" }, "require": { @@ -14195,7 +14195,7 @@ "type": "github" } ], - "time": "2024-05-31T13:53:37+00:00" + "time": "2024-06-06T12:19:22+00:00" }, { "name": "phpunit/php-code-coverage", From c3be10d64b4157f76d2b6acc38967255a1e3214f Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 7 Jun 2024 03:59:48 -0400 Subject: [PATCH 029/140] refactor: apps_id --- app/GraphQL/Social/Mutations/Tags/TagsManagement.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 3861515c3..616bf0384 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -29,8 +29,8 @@ public function create(mixed $root, array $request): Tag public function update(mixed $root, array $request): Tag { $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { - return $query->where('users_id', auth()->user()->getId()); - })->where('id', $request['id']) + return $query->where('users_id', auth()->user()->getId()); + })->where('id', $request['id']) ->firstOrFail(); $tag->update($request['input']); @@ -41,8 +41,8 @@ public function update(mixed $root, array $request): Tag public function delete(mixed $root, array $request): bool { $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { - return $query->where('users_id', auth()->user()->getId()); - }) + return $query->where('users_id', auth()->user()->getId()); + }) ->where('id', $request['id']) ->firstOrFail(); @@ -63,7 +63,7 @@ public function follow(mixed $root, array $request): bool public function attachTagToEntity(mixed $root, array $request): bool { - $tag = Tag::where('users_id', auth()->user()->getId()) + $tag = Tag::where('apps_id', app(Apps::class)->getId()) ->where('id', $request['input']['tag_id']) ->firstOrFail(); From 07272f00452ae74c7b0195d736bb08ed531775c8 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 7 Jun 2024 09:14:39 -0400 Subject: [PATCH 030/140] refact: feature --- .../Social/Mutations/Tags/TagsManagement.php | 30 ++++++++++++++----- .../2024_06_05_154618_tags_entities.php | 18 ++++++----- .../Social/Tags/Actions/CreateTagAction.php | 8 ++--- src/Domains/Social/Tags/Models/Tag.php | 2 +- src/Domains/Social/Tags/Models/TagEntity.php | 2 ++ 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 616bf0384..7de68460f 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -11,6 +11,7 @@ use Kanvas\Social\Tags\Actions\CreateTagAction; use Kanvas\Social\Tags\DataTransferObjects\Tag as TagData; use Kanvas\Social\Tags\Models\Tag; +use Kanvas\SystemModules\DataTransferObject\SystemModuleEntityInput; use Kanvas\SystemModules\Repositories\SystemModulesRepository; class TagsManagement @@ -28,9 +29,12 @@ public function create(mixed $root, array $request): Tag public function update(mixed $root, array $request): Tag { + $app = app(Apps::class); + $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { return $query->where('users_id', auth()->user()->getId()); })->where('id', $request['id']) + ->fromApp($app) ->firstOrFail(); $tag->update($request['input']); @@ -40,10 +44,12 @@ public function update(mixed $root, array $request): Tag public function delete(mixed $root, array $request): bool { + $app = app(Apps::class); $tag = Tag::when(! auth()->user()->isAdmin(), function ($query) { return $query->where('users_id', auth()->user()->getId()); }) ->where('id', $request['id']) + ->fromApp($app) ->firstOrFail(); @@ -52,7 +58,8 @@ public function delete(mixed $root, array $request): bool public function follow(mixed $root, array $request): bool { - $tag = Tag::find($request['id']); + $app = app(Apps::class); + $tag = Tag::getById($request['id'], $app); $isFollowing = UsersFollowsRepository::isFollowing(auth()->user(), $tag); if ($isFollowing) { return (new UnFollowAction(auth()->user(), $tag))->execute(); @@ -63,19 +70,26 @@ public function follow(mixed $root, array $request): bool public function attachTagToEntity(mixed $root, array $request): bool { - $tag = Tag::where('apps_id', app(Apps::class)->getId()) - ->where('id', $request['input']['tag_id']) - ->firstOrFail(); + $app = app(Apps::class); + $tag = Tag::getById($request['input']['tag_id'], $app); + $user = auth()->user(); $systemModule = SystemModulesRepository::getByName($request['input']['system_module_name']); - - $entity = $systemModule->model_name::find((int)$request['input']['entity_id']); + //$entity = $systemModule->model_name::getById((int)$request['input']['entity_id'], $app); + $entity = SystemModulesRepository::getEntityFromInput( + new SystemModuleEntityInput( + $systemModule->name, + $systemModule->uuid, + $request['input']['entity_id'] + ), + $user + ); $tag->entities()->attach($entity->getId(), [ 'entity_namespace' => $systemModule->model_name, 'apps_id' => $tag->apps_id, - 'companies_id' => auth()->user()->getCurrentCompany()->getId(), - 'users_id' => auth()->user()->getId(), + 'companies_id' => $user->getCurrentCompany()->getId(), + 'users_id' => $user->getId(), 'taggable_type' => $systemModule->model_name, ]); diff --git a/database/migrations/Social/2024_06_05_154618_tags_entities.php b/database/migrations/Social/2024_06_05_154618_tags_entities.php index 719c97a27..3cab1cce3 100644 --- a/database/migrations/Social/2024_06_05_154618_tags_entities.php +++ b/database/migrations/Social/2024_06_05_154618_tags_entities.php @@ -12,15 +12,17 @@ public function up(): void { Schema::create('tags_entities', function (Blueprint $table) { $table->id(); - $table->integer('tags_id')->index('tags_id'); - $table->integer('entity_id')->index('entity_id'); - $table->string('entity_namespace')->index('entity_namespace'); - $table->integer('companies_id')->index('companies_id'); - $table->integer('apps_id')->index('apps_id'); - $table->integer('users_id'); + $table->integer('tags_id')->index(); + $table->integer('entity_id')->index(); + $table->string('entity_namespace')->index(); + $table->integer('companies_id')->index(); + $table->integer('apps_id')->index(); + $table->integer('users_id')->index(); $table->boolean('is_deleted')->default(0); - $table->timestamp('created_at')->index('created_at')->useCurrent(); - $table->datetime('updated_at')->nullable()->index('updated_at'); + $table->timestamp('created_at')->index()->useCurrent(); + $table->datetime('updated_at')->nullable()->index(); + $table->index(['tags_id', 'entity_id', 'is_deleted'], 'tags_entities_index_tag'); + $table->index(['tags_id', 'entity_id', 'apps_id', 'is_deleted'], 'tags_entities_app_index'); $table->index(['tags_id', 'entity_id', 'companies_id', 'apps_id', 'is_deleted'], 'tags_entities_index'); }); } diff --git a/src/Domains/Social/Tags/Actions/CreateTagAction.php b/src/Domains/Social/Tags/Actions/CreateTagAction.php index 8839c04d8..d9829b0a5 100644 --- a/src/Domains/Social/Tags/Actions/CreateTagAction.php +++ b/src/Domains/Social/Tags/Actions/CreateTagAction.php @@ -4,8 +4,8 @@ namespace Kanvas\Social\Tags\Actions; -use Kanvas\Social\Tags\Models\Tag; use Kanvas\Social\Tags\DataTransferObjects\Tag as TagData; +use Kanvas\Social\Tags\Models\Tag; class CreateTagAction { @@ -15,12 +15,12 @@ public function __construct(private TagData $tagData) public function execute(): Tag { - return Tag::create([ + return Tag::firstOrCreate([ 'apps_id' => $this->tagData->app->getId(), - 'users_id' => $this->tagData->user?->getId(), 'companies_id' => $this->tagData->company->getId(), 'name' => $this->tagData->name, - 'slug' => $this->tagData->slug, + ], [ + 'users_id' => $this->tagData->user?->getId(), 'weight' => $this->tagData->weight, ]); } diff --git a/src/Domains/Social/Tags/Models/Tag.php b/src/Domains/Social/Tags/Models/Tag.php index be4da05dc..03cc52ab3 100644 --- a/src/Domains/Social/Tags/Models/Tag.php +++ b/src/Domains/Social/Tags/Models/Tag.php @@ -4,8 +4,8 @@ namespace Kanvas\Social\Tags\Models; -use Kanvas\Social\Models\BaseModel; use Baka\Traits\SlugTrait; +use Kanvas\Social\Models\BaseModel; /** * @property int id diff --git a/src/Domains/Social/Tags/Models/TagEntity.php b/src/Domains/Social/Tags/Models/TagEntity.php index 16aa08231..3be602657 100644 --- a/src/Domains/Social/Tags/Models/TagEntity.php +++ b/src/Domains/Social/Tags/Models/TagEntity.php @@ -20,6 +20,8 @@ class TagEntity extends MorphPivot 'is_deleted', ]; + protected $connection = 'social'; + public function entity() { return $this->morphTo(null, 'entity_namespace', 'entity_id'); From c78cfa77439e46ad663412843d75c1ba93233333 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 7 Jun 2024 10:05:15 -0400 Subject: [PATCH 031/140] refact; how to fetch entity --- app/GraphQL/Social/Mutations/Tags/TagsManagement.php | 7 +++++-- graphql/schemas/Social/tags.graphql | 2 +- .../Repositories/SystemModulesRepository.php | 6 +++--- tests/GraphQL/Social/TagsTest.php | 12 ++++++------ 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 7de68460f..cfbd89538 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -12,6 +12,7 @@ use Kanvas\Social\Tags\DataTransferObjects\Tag as TagData; use Kanvas\Social\Tags\Models\Tag; use Kanvas\SystemModules\DataTransferObject\SystemModuleEntityInput; +use Kanvas\SystemModules\Models\SystemModules; use Kanvas\SystemModules\Repositories\SystemModulesRepository; class TagsManagement @@ -74,7 +75,8 @@ public function attachTagToEntity(mixed $root, array $request): bool $tag = Tag::getById($request['input']['tag_id'], $app); $user = auth()->user(); - $systemModule = SystemModulesRepository::getByName($request['input']['system_module_name']); + $systemModule = SystemModules::getByUuid($request['input']['system_module_uuid'], $app); + //$entity = $systemModule->model_name::getById((int)$request['input']['entity_id'], $app); $entity = SystemModulesRepository::getEntityFromInput( new SystemModuleEntityInput( @@ -82,7 +84,8 @@ public function attachTagToEntity(mixed $root, array $request): bool $systemModule->uuid, $request['input']['entity_id'] ), - $user + $user, + useCompanyReference: false ); $tag->entities()->attach($entity->getId(), [ diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql index 7f8b23352..8fc5628cc 100644 --- a/graphql/schemas/Social/tags.graphql +++ b/graphql/schemas/Social/tags.graphql @@ -27,7 +27,7 @@ type TagEntity { input AttachTagEntityInput { entity_id: ID! tag_id: ID! - system_module_name: String! + system_module_uuid: String! } extend type Mutation @guard { diff --git a/src/Kanvas/SystemModules/Repositories/SystemModulesRepository.php b/src/Kanvas/SystemModules/Repositories/SystemModulesRepository.php index 72b89f208..fd334eb92 100644 --- a/src/Kanvas/SystemModules/Repositories/SystemModulesRepository.php +++ b/src/Kanvas/SystemModules/Repositories/SystemModulesRepository.php @@ -61,7 +61,7 @@ public static function getByName(string $name, ?AppInterface $app = null): Syste /** * Get the entity from the input */ - public static function getEntityFromInput(SystemModuleInputInterface $entityInput, Users $user): Model + public static function getEntityFromInput(SystemModuleInputInterface $entityInput, Users $user, bool $useCompanyReference = true): Model { $systemModule = self::getByUuidOrModelName($entityInput->systemModuleUuid); @@ -80,7 +80,7 @@ public static function getEntityFromInput(SystemModuleInputInterface $entityInpu if (! $hasAppId && ! $hasCompanyId && (! $isUser && ! $isCompany)) { throw new InternalServerErrorException('This system module doesn\'t allow external custom fields'); } - $field = $hasUuid ? 'uuid' : 'id'; + $field = $hasUuid && Str::isUuid($entityInput->entityId) ? 'uuid' : 'id'; if ($isUser || $isCompany) { $entity = $entityModel::where('uuid', $entityInput->entityId) @@ -104,7 +104,7 @@ public static function getEntityFromInput(SystemModuleInputInterface $entityInpu ); } } else { - if ($user->isAppOwner()) { + if ($user->isAppOwner() || ! $useCompanyReference) { $entity = $entityModel::where($field, $entityInput->entityId) ->fromApp() ->notDeleted() diff --git a/tests/GraphQL/Social/TagsTest.php b/tests/GraphQL/Social/TagsTest.php index 25dff8860..84cd96521 100644 --- a/tests/GraphQL/Social/TagsTest.php +++ b/tests/GraphQL/Social/TagsTest.php @@ -5,6 +5,8 @@ namespace Tests\GraphQL\Social; use Baka\Support\Str; +use Kanvas\Apps\Models\Apps; +use Kanvas\Companies\Models\Companies; use Kanvas\Social\Messages\Models\Message; use Kanvas\Social\MessagesTypes\Models\MessageType; use Kanvas\SystemModules\Models\SystemModules; @@ -16,7 +18,6 @@ public function testCreateTag() { $input = [ 'name' => fake()->name(), - 'slug' => Str::slug(fake()->name()), 'weight' => random_int(1, 100), ]; $this->graphQL(/** @lang GRAPHQL */ @@ -223,6 +224,7 @@ public function testAttachTagToMessage() $messageType = MessageType::factory()->create(); $message = fake()->text(); Message::makeAllSearchable(); + $app = app(Apps::class); $response = $this->graphQL( ' @@ -242,13 +244,12 @@ public function testAttachTagToMessage() ], ] ); - $systemModule = SystemModules::find(1); + $systemModule = SystemModules::fromApp($app)->where('model_name', Message::class)->first(); $message = $response->json('data.createMessage'); $input = [ 'name' => fake()->name(), - 'slug' => Str::slug(fake()->name()), 'weight' => random_int(1, 100), ]; @@ -261,7 +262,6 @@ public function testAttachTagToMessage() createTag(input: $input) { id name - slug weight } } @@ -270,10 +270,11 @@ public function testAttachTagToMessage() 'input' => $input, ] ); + $tag = $response->json('data.createTag'); $attach = [ 'tag_id' => $tag['id'], - 'system_module_name' => $systemModule->name, + 'system_module_uuid' => $systemModule->uuid, 'entity_id' => $message['id'], ]; $this->graphQL(/** @lang GRAPHQL */ @@ -324,7 +325,6 @@ public function testAttachTagToMessage() [ 'id' => $tag['id'], 'name' => $input['name'], - 'slug' => $input['slug'], 'weight' => $input['weight'], 'taggables' => [ [ From 1fc0db1aa7703ee749d79042d619a12390378249 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 7 Jun 2024 10:10:53 -0400 Subject: [PATCH 032/140] refact: relationship --- graphql/schemas/Social/channels.graphql | 2 +- graphql/schemas/Social/tags.graphql | 1 + src/Domains/Social/Tags/Models/TagEntity.php | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/graphql/schemas/Social/channels.graphql b/graphql/schemas/Social/channels.graphql index b677e054a..d896b4070 100644 --- a/graphql/schemas/Social/channels.graphql +++ b/graphql/schemas/Social/channels.graphql @@ -13,7 +13,7 @@ type SocialChannel { last_message_id: ID messages: [Message!]! @belongsToMany users: [User!]! @belongsToMany - systemModule: SystemModule! + systemModule: SystemModule! @belongsTo } input SocialChannelInput { diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql index 8fc5628cc..2a72874b6 100644 --- a/graphql/schemas/Social/tags.graphql +++ b/graphql/schemas/Social/tags.graphql @@ -20,6 +20,7 @@ type TagEntity { entity_id: ID! tags_id: ID! system_module_name: String! + system_module: SystemModule! @belongsTo(method: "systemModule") created_at: String updated_at: String } diff --git a/src/Domains/Social/Tags/Models/TagEntity.php b/src/Domains/Social/Tags/Models/TagEntity.php index 3be602657..28bf2e7c6 100644 --- a/src/Domains/Social/Tags/Models/TagEntity.php +++ b/src/Domains/Social/Tags/Models/TagEntity.php @@ -2,7 +2,9 @@ namespace Kanvas\Social\Tags\Models; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphPivot; +use Kanvas\SystemModules\Models\SystemModules; class TagEntity extends MorphPivot { @@ -26,4 +28,9 @@ public function entity() { return $this->morphTo(null, 'entity_namespace', 'entity_id'); } + + public function systemModule(): BelongsTo + { + return $this->belongsTo(SystemModules::class, 'entity_namespace', 'model_name')->where('apps_id', $this->apps_id); + } } From abbc98e10e0c15bf1ac2ec10e28e73ac5c44faf8 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 11:29:23 -0400 Subject: [PATCH 033/140] force delete to pivot tables --- .../Inventory/Status/Models/VariantWarehouseStatusHistory.php | 4 +++- src/Domains/Inventory/Variants/Models/VariantsChannels.php | 1 + .../Variants/Models/VariantsWarehousesPriceHistory.php | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php b/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php index 22a630099..05f52ad42 100644 --- a/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php +++ b/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php @@ -27,7 +27,9 @@ class VariantWarehouseStatusHistory extends BaseModel protected $table = 'products_variants_warehouse_status_history'; protected $guarded = []; - protected $primaryKey = ['products_variants_id', 'warehouses_id']; + protected $primaryKey = ['products_variants_warehouse_id', 'status_id']; + protected $forceDeleting = true; + /** * Get the user that owns the Variants. diff --git a/src/Domains/Inventory/Variants/Models/VariantsChannels.php b/src/Domains/Inventory/Variants/Models/VariantsChannels.php index bf8752f91..ddbd63ad0 100644 --- a/src/Domains/Inventory/Variants/Models/VariantsChannels.php +++ b/src/Domains/Inventory/Variants/Models/VariantsChannels.php @@ -40,6 +40,7 @@ class VariantsChannels extends BaseModel protected $guarded = []; protected $primaryKey = ['product_variants_warehouse_id', 'channels_id']; + protected $forceDeleting = true; public function channel(): BelongsTo { diff --git a/src/Domains/Inventory/Variants/Models/VariantsWarehousesPriceHistory.php b/src/Domains/Inventory/Variants/Models/VariantsWarehousesPriceHistory.php index c11a79f18..a94376582 100644 --- a/src/Domains/Inventory/Variants/Models/VariantsWarehousesPriceHistory.php +++ b/src/Domains/Inventory/Variants/Models/VariantsWarehousesPriceHistory.php @@ -23,6 +23,8 @@ class VariantsWarehousesPriceHistory extends BaseModel use NoCompanyRelationshipTrait; protected $table = 'products_variants_warehouses_price_history'; + protected $primaryKey = 'product_variants_warehouse_id'; public $timestamps = false; protected $guarded = []; + protected $forceDeleting = true; } From e5106bb3323cf525a0e79e286731baaa47848286 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 11:31:10 -0400 Subject: [PATCH 034/140] overwrite trashed and cast is_deleted as boolean --- src/Domains/Inventory/Models/BaseModel.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Domains/Inventory/Models/BaseModel.php b/src/Domains/Inventory/Models/BaseModel.php index 4377beed7..78d13d2d9 100644 --- a/src/Domains/Inventory/Models/BaseModel.php +++ b/src/Domains/Inventory/Models/BaseModel.php @@ -33,7 +33,25 @@ class BaseModel extends EloquentModel 'is_deleted' => 0, ]; + /** + * Prevent laravel from cast is_deleted as date using carbon. + * + */ + protected $casts = [ + 'is_deleted' => 'boolean', + ]; + protected $connection = 'inventory'; public const DELETED_AT = 'is_deleted'; + + /** + * Determine if the model instance has been soft-deleted. + * + * @return bool + */ + public function trashed() + { + return $this->{$this->getDeletedAtColumn()}; + } } From a75d42e4237413d8718287aa794466c6b9b73d59 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 11:31:48 -0400 Subject: [PATCH 035/140] add relation for the cascade softdelete on warehou --- .../Variants/Models/VariantsWarehouses.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Domains/Inventory/Variants/Models/VariantsWarehouses.php b/src/Domains/Inventory/Variants/Models/VariantsWarehouses.php index d2bdf9d17..cb276f542 100644 --- a/src/Domains/Inventory/Variants/Models/VariantsWarehouses.php +++ b/src/Domains/Inventory/Variants/Models/VariantsWarehouses.php @@ -6,6 +6,7 @@ use Baka\Traits\NoAppRelationshipTrait; use Baka\Traits\NoCompanyRelationshipTrait; +use Dyrynda\Database\Support\CascadeSoftDeletes; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; @@ -44,8 +45,11 @@ class VariantsWarehouses extends BaseModel { use NoAppRelationshipTrait; use NoCompanyRelationshipTrait; + use CascadeSoftDeletes; protected $table = 'products_variants_warehouses'; + protected $cascadeDeletes = ['variantWarehousesStatusHistory', 'pricesHistory', 'variantChannels']; + protected $guarded = []; /** @@ -100,6 +104,19 @@ public function pricesHistory(): HasMany ); } + public function variantWarehousesStatusHistory(): HasMany + { + return $this->hasMany( + VariantWarehouseStatusHistory::class, + 'products_variants_warehouse_id' + ); + } + + public function variantChannels(): HasMany + { + return $this->hasMany(VariantsChannels::class, 'product_variants_warehouse_id')->where('is_published', 1); + } + /** * Get the status history with the status information. * From 61865e6f18ef3ce68d9b19c7e965c31c12abc589 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 11:32:07 -0400 Subject: [PATCH 036/140] verifiy if is deleted and present to restore --- .../Inventory/Warehouses/Services/WarehouseService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php index b8e847aaf..662d7237d 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -32,6 +32,11 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ foreach ($warehouses as $warehouseData) { $warehouseModel = WarehouseRepository::getById((int) $warehouseData['id'], $variant->product->company); + $variantWarehouseData = $variant->variantWarehouses()->where('warehouses_id', $warehouseModel->getId())->withTrashed()->first(); + + if($variantWarehouseData->trashed()) { + $variantWarehouseData->restore(); + } if (isset($warehouseData['status'])) { $warehouseData['status_id'] = StatusRepository::getById( From a1fbfecf0c1049ea31496cccbe3545276aaa376c Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 11:45:47 -0400 Subject: [PATCH 037/140] stylo --- src/Domains/Inventory/Warehouses/Services/WarehouseService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php index 662d7237d..fcb487389 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -34,7 +34,7 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $warehouseModel = WarehouseRepository::getById((int) $warehouseData['id'], $variant->product->company); $variantWarehouseData = $variant->variantWarehouses()->where('warehouses_id', $warehouseModel->getId())->withTrashed()->first(); - if($variantWarehouseData->trashed()) { + if ($variantWarehouseData->trashed()) { $variantWarehouseData->restore(); } From 0b6d6ea896cd2db30b5dd40f631d8b3abbce56ee Mon Sep 17 00:00:00 2001 From: Rafael White Date: Fri, 7 Jun 2024 12:24:08 -0400 Subject: [PATCH 038/140] revert back --- development.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/development.Dockerfile b/development.Dockerfile index e078417c3..a96eff554 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -40,6 +40,8 @@ COPY . /app # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN composer install --optimize-autoloader + # add root to www group # RUN chmod -R ug+w var/www/html/storage @@ -50,6 +52,4 @@ RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini WORKDIR /var/www/html/ -RUN composer install --optimize-autoloader - EXPOSE 8080 \ No newline at end of file From b9193f9f82f490d93a5dd0eed5c0f144670ab936 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Fri, 7 Jun 2024 12:25:11 -0400 Subject: [PATCH 039/140] rever changes --- development.Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/development.Dockerfile b/development.Dockerfile index a96eff554..53ed9c687 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -26,7 +26,6 @@ RUN apt-get update && apt-get install -y \ nginx \ vim - # Set working directory WORKDIR /app From e4eb679bb6d67cfe3985ba3040776cf092b5e845 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 7 Jun 2024 13:45:46 -0400 Subject: [PATCH 040/140] refactor: add tags queries --- .../Social/Queries/Tags/TagsQueries.php | 22 ++++++++ graphql/schemas/Guild/lead.graphql | 6 +++ graphql/schemas/Guild/organization.graphql | 6 +++ graphql/schemas/Guild/people.graphql | 7 +++ graphql/schemas/Social/message.graphql | 6 +++ tests/GraphQL/Social/TagsTest.php | 54 ++++++++++++++++++- 6 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 app/GraphQL/Social/Queries/Tags/TagsQueries.php diff --git a/app/GraphQL/Social/Queries/Tags/TagsQueries.php b/app/GraphQL/Social/Queries/Tags/TagsQueries.php new file mode 100644 index 000000000..646573591 --- /dev/null +++ b/app/GraphQL/Social/Queries/Tags/TagsQueries.php @@ -0,0 +1,22 @@ +where('entity_id', $root->getKey()); + $query->where('entity_namespace', $systemModule->model_name); + })->where('is_deleted', StateEnums::NO->getValue()); + } +} diff --git a/graphql/schemas/Guild/lead.graphql b/graphql/schemas/Guild/lead.graphql index ee2465d94..d725f912b 100644 --- a/graphql/schemas/Guild/lead.graphql +++ b/graphql/schemas/Guild/lead.graphql @@ -23,6 +23,12 @@ type Lead { participants: [LeadsParticipants!]! @hasMany channels: [SocialChannel]! @hasMany(relation: "socialChannels") systemModule: SystemModule + tags: [Tag!] + @paginate + ( + defaultCount: 25 + builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" + ) files: [Filesystem!]! @paginate( defaultCount: 25 diff --git a/graphql/schemas/Guild/organization.graphql b/graphql/schemas/Guild/organization.graphql index e74497cbd..8f7035963 100644 --- a/graphql/schemas/Guild/organization.graphql +++ b/graphql/schemas/Guild/organization.graphql @@ -5,6 +5,12 @@ type Organization { user: User! @belongsTo name: String! address: String + tags: [Tag!] + @paginate + ( + defaultCount: 25 + builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" + ) } input OrganizationInput { diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 404c9d056..3c353f387 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -20,6 +20,13 @@ type People { defaultCount: 25 builder: "App\\GraphQL\\Ecosystem\\Queries\\CustomFields\\CustomFieldQuery@getAllByGraphType" ) + tags: [Tag!] + @paginate + ( + defaultCount: 25 + builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" + ) + } type PeopleRelationship { diff --git a/graphql/schemas/Social/message.graphql b/graphql/schemas/Social/message.graphql index 3336e9308..924cbb990 100644 --- a/graphql/schemas/Social/message.graphql +++ b/graphql/schemas/Social/message.graphql @@ -23,6 +23,12 @@ type Message { defaultCount: 25 builder: "App\\GraphQL\\Ecosystem\\Queries\\CustomFields\\CustomFieldQuery@getAllByGraphType" ) + tags: [Tag!] + @paginate + ( + defaultCount: 25 + builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" + ) } type AppModuleMessage { diff --git a/tests/GraphQL/Social/TagsTest.php b/tests/GraphQL/Social/TagsTest.php index 84cd96521..1cd657e45 100644 --- a/tests/GraphQL/Social/TagsTest.php +++ b/tests/GraphQL/Social/TagsTest.php @@ -6,7 +6,6 @@ use Baka\Support\Str; use Kanvas\Apps\Models\Apps; -use Kanvas\Companies\Models\Companies; use Kanvas\Social\Messages\Models\Message; use Kanvas\Social\MessagesTypes\Models\MessageType; use Kanvas\SystemModules\Models\SystemModules; @@ -244,7 +243,9 @@ public function testAttachTagToMessage() ], ] ); - $systemModule = SystemModules::fromApp($app)->where('model_name', Message::class)->first(); + $systemModule = SystemModules::fromApp($app) + ->where('model_name', Message::class) + ->first(); $message = $response->json('data.createMessage'); @@ -337,5 +338,54 @@ public function testAttachTagToMessage() ], ], ]); + + $this->graphQL( + ' + query message( + $where: QueryMessagesWhereWhereConditions + ){ + messages(where: $where) { + data { + id + message + tags { + data { + id + name + slug + weight + } + } + } + } + }', + [ + 'where' => [ + 'value' => $message['id'], + 'column' => 'ID', + 'operator' => 'EQ', + ], + ] + )->assertJson([ + 'data' => [ + 'messages' => [ + 'data' => [ + [ + 'id' => $message['id'], + 'message' => $message['message'], + 'tags' => [ + 'data' => [ + [ + 'id' => $tag['id'], + 'name' => $input['name'], + 'weight' => $input['weight'], + ] + ], + ] + ], + ], + ], + ], + ]); } } From f9a339749b99a2ebea8d534332fcb1a11b08182f Mon Sep 17 00:00:00 2001 From: Rafael White Date: Fri, 7 Jun 2024 15:34:23 -0400 Subject: [PATCH 041/140] add prod docker compose file --- docker-compose.prod.yml | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 docker-compose.prod.yml diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 000000000..406df4de3 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,114 @@ +services: + php: + container_name: php${APP_CONTAINER_NAME} + build: + context: . + dockerfile: 1.x.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan lighthouse:cache && php artisan config:cache"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue: + container_name: queue + build: + context: . + dockerfile: 1.x.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue-social: + container_name: queue-social + build: + context: . + dockerfile: 1.x.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue kanvas-social --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + queue-notifications: + container_name: queue-notifications + build: + context: . + dockerfile: 1.x.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue notifications --tries=3 --timeout=1750 --max-jobs=1000"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail + 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 + redis: + container_name: redis${APP_CONTAINER_NAME} + image: 'redis:alpine' + ports: + - '${FORWARD_REDIS_PORT:-6379}:6379' + volumes: + - 'sail-redis:/data' + networks: + - sail + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + retries: 3 + timeout: 5s +networks: + sail: + driver: bridge +volumes: + sail-redis: + driver: local From b039fbd08308f5798c0f7306a1ccfafa2e5ae7c2 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Fri, 7 Jun 2024 18:47:07 -0400 Subject: [PATCH 042/140] add composer install after working dir --- development.Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/development.Dockerfile b/development.Dockerfile index 53ed9c687..bec108209 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -39,9 +39,6 @@ COPY . /app # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --optimize-autoloader - - # add root to www group # RUN chmod -R ug+w var/www/html/storage @@ -51,4 +48,6 @@ RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini WORKDIR /var/www/html/ +RUN composer install --optimize-autoloader + EXPOSE 8080 \ No newline at end of file From ae674f6532b94982db11f1574ec071bd61ab3065 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Fri, 7 Jun 2024 18:49:09 -0400 Subject: [PATCH 043/140] add command for php container --- docker-compose.dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index ddf70f215..3d54923f0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -6,7 +6,7 @@ services: dockerfile: development.Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' - # command: ["sh", "-c", "php artisan lighthouse:cache && php artisan config:cache"] + command: ["sh", "-c", "php artisan lighthouse:cache && php artisan config:cache"] environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From 84f43d60018ee14e24dfde08e2b8689024724e4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 22:54:26 +0000 Subject: [PATCH 044/140] build(deps-dev): bump phpunit/phpunit from 11.1.3 to 11.2.0 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.1.3 to 11.2.0. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/11.2.0/ChangeLog-11.2.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/11.1.3...11.2.0) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index f7d4c83a7..ecec53f07 100644 --- a/composer.lock +++ b/composer.lock @@ -14522,16 +14522,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.1.3", + "version": "11.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d475be032238173ca3b0a516f5cc291d174708ae" + "reference": "705eba0190afe04bc057f565ad843267717cf109" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d475be032238173ca3b0a516f5cc291d174708ae", - "reference": "d475be032238173ca3b0a516f5cc291d174708ae", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/705eba0190afe04bc057f565ad843267717cf109", + "reference": "705eba0190afe04bc057f565ad843267717cf109", "shasum": "" }, "require": { @@ -14570,7 +14570,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.1-dev" + "dev-main": "11.2-dev" } }, "autoload": { @@ -14602,7 +14602,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.1.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.0" }, "funding": [ { @@ -14618,7 +14618,7 @@ "type": "tidelift" } ], - "time": "2024-04-24T06:34:25+00:00" + "time": "2024-06-07T04:48:50+00:00" }, { "name": "sebastian/cli-parser", From d4986d41e90fea169e4d6baf2d9684df554eb52c Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 7 Jun 2024 19:46:12 -0400 Subject: [PATCH 045/140] refactor: change name of property and app change name of property from users to user in tag grapqhql and set app in system modules repositories --- app/GraphQL/Social/Queries/Tags/TagsQueries.php | 3 ++- graphql/schemas/Social/tags.graphql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/GraphQL/Social/Queries/Tags/TagsQueries.php b/app/GraphQL/Social/Queries/Tags/TagsQueries.php index 646573591..835dcd2d9 100644 --- a/app/GraphQL/Social/Queries/Tags/TagsQueries.php +++ b/app/GraphQL/Social/Queries/Tags/TagsQueries.php @@ -7,12 +7,13 @@ use Baka\Enums\StateEnums; use Kanvas\Social\Tags\Models\Tag; use Kanvas\SystemModules\Repositories\SystemModulesRepository; +use Kanvas\Apps\Models\Apps; class TagsQueries { public function getTagsBuilder(mixed $root, array $args): mixed { - $systemModule = SystemModulesRepository::getByModelName($root::class); + $systemModule = SystemModulesRepository::getByModelName($root::class, app(Apps::class)); return Tag::whereHas('taggables', function ($query) use ($root, $systemModule) { $query->where('entity_id', $root->getKey()); diff --git a/graphql/schemas/Social/tags.graphql b/graphql/schemas/Social/tags.graphql index 2a72874b6..edd811b51 100644 --- a/graphql/schemas/Social/tags.graphql +++ b/graphql/schemas/Social/tags.graphql @@ -6,7 +6,7 @@ input TagInput { type Tag { id: ID! - users: User! + user: User! name: String! slug: String weight: Int From b342712088936a99166061c6db491dee3a9c4bcf Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 20:02:22 -0400 Subject: [PATCH 046/140] fix --- .../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 fcb487389..54eb27808 100644 --- a/src/Domains/Inventory/Warehouses/Services/WarehouseService.php +++ b/src/Domains/Inventory/Warehouses/Services/WarehouseService.php @@ -34,7 +34,7 @@ public static function updateWarehouseVariant(Variants $variant, UserInterface $ $warehouseModel = WarehouseRepository::getById((int) $warehouseData['id'], $variant->product->company); $variantWarehouseData = $variant->variantWarehouses()->where('warehouses_id', $warehouseModel->getId())->withTrashed()->first(); - if ($variantWarehouseData->trashed()) { + if ($variantWarehouseData && $variantWarehouseData->trashed()) { $variantWarehouseData->restore(); } @@ -102,7 +102,7 @@ public static function removeVariantWarehouses( $variant->company, $user ); - $variantWarehouse = $variant->variantWarehouses('warehouses_id', $warehouse->getId()); + $variantWarehouse = $variant->variantWarehouses()->where('warehouses_id', $warehouse->getId()); $variantWarehouse->first()->delete(); return $variant; From 546804328b561273c0eff0f001d60282576fb7e8 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 23:21:25 -0400 Subject: [PATCH 047/140] Create action to update variants --- .../Variants/Actions/UpdateVariantsAction.php | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php diff --git a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php new file mode 100644 index 000000000..f9b971caf --- /dev/null +++ b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php @@ -0,0 +1,62 @@ +variantDto->product->company()->get()->first(), + $this->user + ); + + if (Variants::where('sku', $this->variantDto->sku) + ->where('companies_id',$this->variantDto->product->companies_id) + ->where('id','!=', $this->variant->getId()) + ->count() + ) { + throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); + } + + $this->variant->update( + [ + 'name' => $this->variantDto->name, + 'slug' => $this->variantDto->slug ?? Str::slug($this->variantDto->name), + 'sku' => $this->variantDto->sku, + 'users_id' => $this->user->getId(), + 'description' => $this->variantDto->description, + 'short_description' => $this->variantDto->short_description, + 'html_description' => $this->variantDto->html_description, + 'status_id' => $this->variantDto->status_id, + 'ean' => $this->variantDto->ean, + 'barcode' => $this->variantDto->barcode, + 'serial_number' => $this->variantDto->serial_number, + + ] + ); + return $this->variant; + } +} From 850d7186e66e843abc9af22f12045c73088ac655 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 23:21:45 -0400 Subject: [PATCH 048/140] Add an sku unique company validation on action --- .../Inventory/Variants/Actions/CreateVariantsAction.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index 335720170..5636ddb22 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -7,6 +7,7 @@ use Baka\Support\Str; use Baka\Users\Contracts\UserInterface; use Kanvas\Companies\Repositories\CompaniesRepository; +use Kanvas\Exceptions\ValidationException; use Kanvas\Inventory\Variants\DataTransferObject\Variants as VariantsDto; use Kanvas\Inventory\Variants\Models\Variants; @@ -31,6 +32,13 @@ public function execute(): Variants $this->user ); + if (Variants::where('sku', $this->variantDto->sku) + ->where('companies_id',$this->variantDto->product->companies_id) + ->count() + ) { + throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); + } + $search = [ 'products_id' => $this->variantDto->product->getId(), 'slug' => $this->variantDto->slug ?? Str::slug($this->variantDto->name), From 9e69828fdbab0fea05f5ffed858fbf378eb8c245 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 23:22:15 -0400 Subject: [PATCH 049/140] Upda update variant action for variant update --- .../Inventory/Mutations/Variants/Variants.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 27e3b5c19..19baf4daa 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -4,6 +4,7 @@ namespace App\GraphQL\Inventory\Mutations\Variants; +use Illuminate\Support\Facades\Validator; use Kanvas\Inventory\Attributes\Repositories\AttributesRepository; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Channels\Repositories\ChannelRepository; @@ -12,6 +13,7 @@ use Kanvas\Inventory\Variants\Actions\AddToWarehouseAction as AddToWarehouse; use Kanvas\Inventory\Variants\Actions\AddVariantToChannelAction; use Kanvas\Inventory\Variants\Actions\CreateVariantsAction; +use Kanvas\Inventory\Variants\Actions\UpdateVariantsAction; use Kanvas\Inventory\Variants\DataTransferObject\VariantChannel; use Kanvas\Inventory\Variants\DataTransferObject\Variants as VariantDto; use Kanvas\Inventory\Variants\DataTransferObject\VariantsWarehouses; @@ -103,17 +105,19 @@ public function update(mixed $root, array $req): VariantModel } $variant = VariantsRepository::getById((int) $req['id'], $company); - $variant->update($req['input']); + $req['input']['products_id'] = $variant->product->getId(); + $variantDto = VariantDto::viaRequest($req['input'], auth()->user()); + $variantModel = (new UpdateVariantsAction($variant, $variantDto, auth()->user()))->execute(); if (isset($req['input']['attributes'])) { - $variant->addAttributes(auth()->user(), $req['input']['attributes']); + $variantModel->addAttributes(auth()->user(), $req['input']['attributes']); } if (isset($req['input']['warehouses'])) { - WarehouseService::updateWarehouseVariant($variant, auth()->user(), $req['input']['warehouses']); + WarehouseService::updateWarehouseVariant($variantModel, auth()->user(), $req['input']['warehouses']); } - return $variant; + return $variantModel; } /** From af8500072e7970f5dc81000afaa1403e2b2b120d Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 23:28:14 -0400 Subject: [PATCH 050/140] update variant tests --- tests/GraphQL/Inventory/VariantTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/GraphQL/Inventory/VariantTest.php b/tests/GraphQL/Inventory/VariantTest.php index c774978e3..e5c4afbe7 100644 --- a/tests/GraphQL/Inventory/VariantTest.php +++ b/tests/GraphQL/Inventory/VariantTest.php @@ -129,6 +129,7 @@ public function testUpdateVariant(): void $data = [ 'name' => fake()->name, 'description' => fake()->text, + 'sku' => $data['sku'] ]; $this->graphQL(' mutation($id: ID! $data: VariantsUpdateInput!) { @@ -136,6 +137,7 @@ public function testUpdateVariant(): void { id name + sku description } }', ['id' => $id, 'data' => $data])->assertJson([ From b192fc403c2468f2a86e0aeaa86ac395ab214d39 Mon Sep 17 00:00:00 2001 From: arfenis Date: Fri, 7 Jun 2024 23:29:17 -0400 Subject: [PATCH 051/140] stylo --- .../Inventory/Variants/Actions/CreateVariantsAction.php | 2 +- .../Inventory/Variants/Actions/UpdateVariantsAction.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index 5636ddb22..c488195c8 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -33,7 +33,7 @@ public function execute(): Variants ); if (Variants::where('sku', $this->variantDto->sku) - ->where('companies_id',$this->variantDto->product->companies_id) + ->where('companies_id', $this->variantDto->product->companies_id) ->count() ) { throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); diff --git a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php index f9b971caf..a656f9571 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php @@ -34,8 +34,8 @@ public function execute(): Variants ); if (Variants::where('sku', $this->variantDto->sku) - ->where('companies_id',$this->variantDto->product->companies_id) - ->where('id','!=', $this->variant->getId()) + ->where('companies_id', $this->variantDto->product->companies_id) + ->where('id', '!=', $this->variant->getId()) ->count() ) { throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); From 220bc469d238e4532cfe4f0e1fbbab6ce6ab9c70 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 09:04:16 -0400 Subject: [PATCH 052/140] refact: filter by app --- app/GraphQL/Social/Queries/Tags/TagsQueries.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/GraphQL/Social/Queries/Tags/TagsQueries.php b/app/GraphQL/Social/Queries/Tags/TagsQueries.php index 835dcd2d9..7b08c6b1a 100644 --- a/app/GraphQL/Social/Queries/Tags/TagsQueries.php +++ b/app/GraphQL/Social/Queries/Tags/TagsQueries.php @@ -5,19 +5,21 @@ namespace App\GraphQL\Social\Queries\Tags; use Baka\Enums\StateEnums; +use Kanvas\Apps\Models\Apps; use Kanvas\Social\Tags\Models\Tag; use Kanvas\SystemModules\Repositories\SystemModulesRepository; -use Kanvas\Apps\Models\Apps; class TagsQueries { public function getTagsBuilder(mixed $root, array $args): mixed { - $systemModule = SystemModulesRepository::getByModelName($root::class, app(Apps::class)); + $app = app(Apps::class); + $systemModule = SystemModulesRepository::getByModelName($root::class, $app); return Tag::whereHas('taggables', function ($query) use ($root, $systemModule) { $query->where('entity_id', $root->getKey()); $query->where('entity_namespace', $systemModule->model_name); + $query->where('apps_id', $systemModule->apps_id); })->where('is_deleted', StateEnums::NO->getValue()); } } From 792a41f0b53616acf8955620a3df20c00630e29b Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 09:10:00 -0400 Subject: [PATCH 053/140] refact: format files --- graphql/schemas/Guild/lead.graphql | 3 +-- graphql/schemas/Guild/organization.graphql | 28 +++++++++++----------- graphql/schemas/Guild/people.graphql | 6 ++--- graphql/schemas/Inventory/product.graphql | 5 ++++ 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/graphql/schemas/Guild/lead.graphql b/graphql/schemas/Guild/lead.graphql index d725f912b..93e10bd34 100644 --- a/graphql/schemas/Guild/lead.graphql +++ b/graphql/schemas/Guild/lead.graphql @@ -24,8 +24,7 @@ type Lead { channels: [SocialChannel]! @hasMany(relation: "socialChannels") systemModule: SystemModule tags: [Tag!] - @paginate - ( + @paginate( defaultCount: 25 builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" ) diff --git a/graphql/schemas/Guild/organization.graphql b/graphql/schemas/Guild/organization.graphql index 8f7035963..c8493c4be 100644 --- a/graphql/schemas/Guild/organization.graphql +++ b/graphql/schemas/Guild/organization.graphql @@ -6,8 +6,7 @@ type Organization { name: String! address: String tags: [Tag!] - @paginate - ( + @paginate( defaultCount: 25 builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" ) @@ -25,13 +24,21 @@ input OrganizationPeopleInput { extend type Mutation @guard { createOrganization(input: OrganizationInput!): Organization - @field(resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@create") + @field( + resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@create" + ) updateOrganization(id: ID!, input: OrganizationInput!): Organization - @field(resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@update") + @field( + resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@update" + ) deleteOrganization(id: ID!): Boolean - @field(resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@delete") + @field( + resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@delete" + ) restoreOrganization(id: ID!): Boolean - @field(resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@restore") + @field( + resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\OrganizationManagementMutation@restore" + ) addPeopleToOrganization(input: OrganizationPeopleInput!): Boolean! @field( resolver: "App\\GraphQL\\Guild\\Mutations\\Organizations\\PeopleOrganizationMutation@add" @@ -44,14 +51,7 @@ extend type Mutation @guard { extend type Query @guard { organizations( - where: _ - @whereConditions( - columns: [ - "id" - "name" - "uuid" - ] - ) + where: _ @whereConditions(columns: ["id", "name", "uuid"]) orderBy: _ @orderBy(columns: ["id", "created_at", "updated_at", "name"]) ): [Organization!]! @paginate( diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 8c56631ad..fa46f37be 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -20,13 +20,11 @@ type People { defaultCount: 25 builder: "App\\GraphQL\\Ecosystem\\Queries\\CustomFields\\CustomFieldQuery@getAllByGraphType" ) - tags: [Tag!] - @paginate - ( + tags: [Tag!] + @paginate( defaultCount: 25 builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" ) - } type PeopleRelationship { diff --git a/graphql/schemas/Inventory/product.graphql b/graphql/schemas/Inventory/product.graphql index fd1604ed2..e3a994a1f 100644 --- a/graphql/schemas/Inventory/product.graphql +++ b/graphql/schemas/Inventory/product.graphql @@ -29,6 +29,11 @@ type Product { defaultCount: 25 builder: "App\\GraphQL\\Ecosystem\\Queries\\CustomFields\\CustomFieldQuery@getAllByGraphType" ) + tags: [Tag!] + @paginate( + defaultCount: 25 + builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" + ) } input ProductInput { From 71c52cc0af323a63e159445ae9fc5eba38512139 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 09:45:14 -0400 Subject: [PATCH 054/140] refact: sku validation --- app/GraphQL/Inventory/Mutations/Variants/Variants.php | 3 +-- .../Inventory/Variants/Actions/CreateVariantsAction.php | 3 ++- .../Inventory/Variants/Actions/UpdateVariantsAction.php | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 19baf4daa..2e7faf7e7 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -4,14 +4,12 @@ namespace App\GraphQL\Inventory\Mutations\Variants; -use Illuminate\Support\Facades\Validator; use Kanvas\Inventory\Attributes\Repositories\AttributesRepository; use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Channels\Repositories\ChannelRepository; use Kanvas\Inventory\Status\Repositories\StatusRepository; use Kanvas\Inventory\Variants\Actions\AddAttributeAction; use Kanvas\Inventory\Variants\Actions\AddToWarehouseAction as AddToWarehouse; -use Kanvas\Inventory\Variants\Actions\AddVariantToChannelAction; use Kanvas\Inventory\Variants\Actions\CreateVariantsAction; use Kanvas\Inventory\Variants\Actions\UpdateVariantsAction; use Kanvas\Inventory\Variants\DataTransferObject\VariantChannel; @@ -91,6 +89,7 @@ public function create(mixed $root, array $req): VariantModel ); } } + return $variantModel; } diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index c488195c8..49fdab861 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -33,7 +33,8 @@ public function execute(): Variants ); if (Variants::where('sku', $this->variantDto->sku) - ->where('companies_id', $this->variantDto->product->companies_id) + ->fromApp($this->variantDto->product->app) + ->fromCompany($this->variantDto->product->company) ->count() ) { throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); diff --git a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php index a656f9571..cdd5612a7 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php @@ -34,7 +34,8 @@ public function execute(): Variants ); if (Variants::where('sku', $this->variantDto->sku) - ->where('companies_id', $this->variantDto->product->companies_id) + ->fromCompany($this->variant->company) + ->fromApp($this->variant->app) ->where('id', '!=', $this->variant->getId()) ->count() ) { @@ -57,6 +58,7 @@ public function execute(): Variants ] ); + return $this->variant; } } From 312da39fc6b5e132d554d5333e9ef44c07d7fa3c Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 10:41:59 -0400 Subject: [PATCH 055/140] refact: rule --- .../Variants/Actions/CreateVariantsAction.php | 15 +++++---- .../Variants/Actions/UpdateVariantsAction.php | 16 +++++---- .../Variants/Validations/UniqueSkuRule.php | 33 +++++++++++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index 49fdab861..583c5f1d2 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -6,10 +6,12 @@ use Baka\Support\Str; use Baka\Users\Contracts\UserInterface; +use Illuminate\Support\Facades\Validator; use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Exceptions\ValidationException; use Kanvas\Inventory\Variants\DataTransferObject\Variants as VariantsDto; use Kanvas\Inventory\Variants\Models\Variants; +use Kanvas\Inventory\Variants\Validations\UniqueSkuRule; class CreateVariantsAction { @@ -32,12 +34,13 @@ public function execute(): Variants $this->user ); - if (Variants::where('sku', $this->variantDto->sku) - ->fromApp($this->variantDto->product->app) - ->fromCompany($this->variantDto->product->company) - ->count() - ) { - throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); + $validator = Validator::make( + ['sku' => $this->variantDto->sku], + ['sku' => new UniqueSkuRule()] + ); + + if ($validator->fails()) { + throw new ValidationException($validator->messages()->__toString()); } $search = [ diff --git a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php index cdd5612a7..7ae6294b2 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php @@ -6,10 +6,12 @@ use Baka\Support\Str; use Baka\Users\Contracts\UserInterface; +use Illuminate\Support\Facades\Validator; use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Exceptions\ValidationException; use Kanvas\Inventory\Variants\DataTransferObject\Variants as VariantsDto; use Kanvas\Inventory\Variants\Models\Variants; +use Kanvas\Inventory\Variants\Validations\UniqueSkuRule; class UpdateVariantsAction { @@ -33,13 +35,13 @@ public function execute(): Variants $this->user ); - if (Variants::where('sku', $this->variantDto->sku) - ->fromCompany($this->variant->company) - ->fromApp($this->variant->app) - ->where('id', '!=', $this->variant->getId()) - ->count() - ) { - throw new ValidationException('Field sku ' . $this->variantDto->sku . ', already saved'); + $validator = Validator::make( + ['sku' => $this->variantDto->sku], + ['sku' => new UniqueSkuRule($this->variant)] + ); + + if ($validator->fails()) { + throw new ValidationException($validator->messages()->__toString()); } $this->variant->update( diff --git a/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php new file mode 100644 index 000000000..d15098e77 --- /dev/null +++ b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php @@ -0,0 +1,33 @@ +fromCompany($this->variant->company) + ->fromApp($this->variant->app); + + if ($this->variant) { + $query->where('id', '!=', $this->variant->getId()); + } + + if ($query->exists()) { + $fail("The $attribute has already been taken."); + } + } +} From 187ff6a963a54c8a925b7b24327b01a30bf57ab2 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 10:52:32 -0400 Subject: [PATCH 056/140] refact: rule --- .../Inventory/Variants/Actions/CreateVariantsAction.php | 2 +- .../Inventory/Variants/Actions/UpdateVariantsAction.php | 2 +- .../Inventory/Variants/Validations/UniqueSkuRule.php | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index 583c5f1d2..f107dcf03 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -36,7 +36,7 @@ public function execute(): Variants $validator = Validator::make( ['sku' => $this->variantDto->sku], - ['sku' => new UniqueSkuRule()] + ['sku' => new UniqueSkuRule($this->variantDto->product->app, $this->variantDto->product->company)] ); if ($validator->fails()) { diff --git a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php index 7ae6294b2..bcfcc9835 100644 --- a/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/UpdateVariantsAction.php @@ -37,7 +37,7 @@ public function execute(): Variants $validator = Validator::make( ['sku' => $this->variantDto->sku], - ['sku' => new UniqueSkuRule($this->variant)] + ['sku' => new UniqueSkuRule($this->variant->app, $this->variant->company, $this->variant)] ); if ($validator->fails()) { diff --git a/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php index d15098e77..9abf1f758 100644 --- a/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php +++ b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php @@ -4,6 +4,8 @@ namespace Kanvas\Inventory\Variants\Validations; +use Baka\Contracts\AppInterface; +use Baka\Contracts\CompanyInterface; use Closure; use Illuminate\Contracts\Validation\ValidationRule; use Kanvas\Inventory\Variants\Models\Variants; @@ -11,6 +13,8 @@ class UniqueSkuRule implements ValidationRule { public function __construct( + protected AppInterface $app, + protected CompanyInterface $company, protected ?Variants $variant = null ) { @@ -19,8 +23,8 @@ public function __construct( public function validate(string $attribute, mixed $value, Closure $fail): void { $query = Variants::where('sku', $value) - ->fromCompany($this->variant->company) - ->fromApp($this->variant->app); + ->fromCompany($this->company) + ->fromApp($this->app); if ($this->variant) { $query->where('id', '!=', $this->variant->getId()); From e49c619f536cefae33a07559ce94dc4fcaca4199 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 10:57:35 -0400 Subject: [PATCH 057/140] refact: rule --- src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php index 9abf1f758..e1c79dee5 100644 --- a/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php +++ b/src/Domains/Inventory/Variants/Validations/UniqueSkuRule.php @@ -17,7 +17,6 @@ public function __construct( protected CompanyInterface $company, protected ?Variants $variant = null ) { - } public function validate(string $attribute, mixed $value, Closure $fail): void From 1672e4acc58fe82151d3e6cc55990a4ffbbd4a1f Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 14:55:29 -0400 Subject: [PATCH 058/140] feat: add lead engagement task --- .../Engagements/TaskEngagementBuilder.php | 33 ++++++++++++ ...8_173343_company_task_engagement_items.php | 45 ++++++++++++++++ .../schemas/ActionEngine/engagement.graphql | 11 ++++ graphql/schemas/ActionEngine/task.graphql | 17 ++++-- .../Tasks/Models/TaskEngagementItem.php | 54 +++++++++++++++++++ 5 files changed, 157 insertions(+), 3 deletions(-) create mode 100644 app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php create mode 100644 database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php create mode 100644 graphql/schemas/ActionEngine/engagement.graphql create mode 100644 src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php diff --git a/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php new file mode 100644 index 000000000..13034a4f3 --- /dev/null +++ b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php @@ -0,0 +1,33 @@ +user()->getCurrentCompany(); + $user = auth()->user(); + $app = app(Apps::class); + + $lead = Lead::getByIdFromCompanyApp($args['lead_id'], $company, $app); + + /** + * @var Builder + */ + return TaskEngagementItem::query()->where('lead_id', $lead->getId()); + } +} diff --git a/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php new file mode 100644 index 000000000..1c7a4a5b7 --- /dev/null +++ b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php @@ -0,0 +1,45 @@ +bigInteger('task_list_id')->index(); + $table->bigInteger('lead_id')->index(); + $table->bigInteger('companies_id')->index(); + $table->bigInteger('apps_id')->index(); + $table->bigInteger('users_id')->index(); + $table->enum('status', ['pending', 'in_progress', 'completed'])->default('pending')->comment('pending, in_progress, completed')->index(); + $table->bigInteger('engagement_start_id')->index(); + $table->bigInteger('engagement_end_id')->index(); + $table->json('config'); + $table->timestamps(); + $table->tinyInteger('is_deleted')->default(0)->index(); + + $table->primary(['task_list_id', 'lead_id']); + $table->index(['task_list_id', 'lead_id', 'companies_id'], 'task_list_company_index'); + $table->index(['task_list_id', 'lead_id', 'apps_id'], 'task_list_apps_index'); + $table->index(['task_list_id', 'lead_id', 'users_id'], 'task_list_users_index'); + $table->index(['task_list_id', 'lead_id', 'engagement_start_id'], 'task_list_engagement_start_index'); + $table->index(['task_list_id', 'lead_id', 'engagement_end_id'], 'task_list_engagement_end_index'); + $table->index(['task_list_id', 'lead_id', 'apps_id', 'companies_id'], 'task_list_apps_company_index'); + $table->index(['task_list_id', 'lead_id', 'status'], 'task_list_status_index'); + $table->index(['task_list_id', 'lead_id', 'is_deleted'], 'task_list_deleted_index'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('company_task_engagement_items'); + } +}; diff --git a/graphql/schemas/ActionEngine/engagement.graphql b/graphql/schemas/ActionEngine/engagement.graphql new file mode 100644 index 000000000..1291a66c4 --- /dev/null +++ b/graphql/schemas/ActionEngine/engagement.graphql @@ -0,0 +1,11 @@ +type Engagement { + id: ID! + uuid: String! + user: User! @belongsTo + company_action: CompanyAction! @belongsTo + message: Message! @belongsTo + lead: Lead! @belongsTo + people: People @belongsTo + entity_uuid: String! + slug: String! +} diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index 90eff7c20..101287a80 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -17,11 +17,22 @@ type TaskListItem { weight: Float! } +type LeadTaskItem { + item: TaskListItem! @belongsTo + lead: Lead! @belongsTo + status: String! + config: Mixed + engagement_start: Engagement! + engagement_end: Engagement + created_at: DateTime! + updated_at: DateTime! +} + extend type Query @guard { - leadTaskList (lead_id: ID!): [TaskList!]! + leadTaskItems(lead_id: ID!): [LeadTaskItem!]! @paginate( - model: "Kanvas\\ActionEngine\\Tasks\\Models\\TaskList" - scopes: ["fromApp", "fromCompany"] + builder: "App\\GraphQL\\ActionEngine\\Builders\\Engagements\\TaskEngagementBuilder@getLeadTaskItems" + scopes: ["fromApp", "fromCompany", "notDeleted"] defaultCount: 25 ) } diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php new file mode 100644 index 000000000..dd2f4644e --- /dev/null +++ b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php @@ -0,0 +1,54 @@ + Json::class, + ]; + + public function item(): BelongsTo + { + return $this->belongsTo(TaskListItem::class, 'task_list_id'); + } + + public function lead(): BelongsTo + { + return $this->belongsTo(Lead::class, 'lead_id'); + } + + public function engagementStart(): HasOne + { + return $this->hasOne(Engagement::class, 'id', 'engagement_start_id'); + } + + public function engagementEnd(): HasOne + { + return $this->hasOne(Engagement::class, 'id', 'engagement_end_id'); + } +} From 185cf1d16b9164b47b4f96f794b83b6fcc8f8225 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 18:27:29 -0400 Subject: [PATCH 059/140] feat: lead engagement tasks --- .../Engagements/TaskEngagementBuilder.php | 20 ++++++++++++++----- graphql/schemas/ActionEngine/task.graphql | 15 +++++++------- .../Models/Engagement.php | 0 .../Tasks/Models/TaskEngagementItem.php | 6 ++++++ .../Tasks/Models/TaskListItem.php | 7 +++++++ 5 files changed, 35 insertions(+), 13 deletions(-) rename src/Domains/ActionEngine/{Engagegments => Engagements}/Models/Engagement.php (100%) diff --git a/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php index 13034a4f3..aa3b132c8 100644 --- a/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php +++ b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php @@ -6,7 +6,7 @@ use GraphQL\Type\Definition\ResolveInfo; use Illuminate\Database\Eloquent\Builder; -use Kanvas\ActionEngine\Tasks\Models\TaskEngagementItem; +use Kanvas\ActionEngine\Tasks\Models\TaskListItem; use Kanvas\Apps\Models\Apps; use Kanvas\Guild\Leads\Models\Lead; use Nuwave\Lighthouse\Support\Contracts\GraphQLContext; @@ -24,10 +24,20 @@ public function getLeadTaskItems( $app = app(Apps::class); $lead = Lead::getByIdFromCompanyApp($args['lead_id'], $company, $app); + $leadId = $lead->getId(); - /** - * @var Builder - */ - return TaskEngagementItem::query()->where('lead_id', $lead->getId()); + return TaskListItem::leftJoin('company_task_engagement_items', function ($join) use ($lead) { + $join->on('company_task_list_items.task_list_id', '=', 'company_task_engagement_items.task_list_id') + ->where('company_task_engagement_items.lead_id', '=', $lead->getId()); + }) + ->select( + 'company_task_list_items.*', + 'company_task_engagement_items.lead_id', + 'company_task_engagement_items.status', + 'company_task_engagement_items.engagement_start_id', + 'company_task_engagement_items.engagement_end_id', + 'company_task_engagement_items.created_at', + 'company_task_engagement_items.updated_at' + ); } } diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index 101287a80..d07fbfc58 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -17,22 +17,21 @@ type TaskListItem { weight: Float! } -type LeadTaskItem { - item: TaskListItem! @belongsTo - lead: Lead! @belongsTo - status: String! +type LeadTaskEngagementItem { + name: String! + action: CompanyAction! @belongsTo + status: String config: Mixed - engagement_start: Engagement! - engagement_end: Engagement + engagement_start: Engagement @hasOne(relation: "engagementStart") + engagement_end: Engagement @hasOne(relation: "engagementEnd") created_at: DateTime! updated_at: DateTime! } extend type Query @guard { - leadTaskItems(lead_id: ID!): [LeadTaskItem!]! + leadTaskItems(lead_id: ID!): [LeadTaskEngagementItem!]! @paginate( builder: "App\\GraphQL\\ActionEngine\\Builders\\Engagements\\TaskEngagementBuilder@getLeadTaskItems" - scopes: ["fromApp", "fromCompany", "notDeleted"] defaultCount: 25 ) } diff --git a/src/Domains/ActionEngine/Engagegments/Models/Engagement.php b/src/Domains/ActionEngine/Engagements/Models/Engagement.php similarity index 100% rename from src/Domains/ActionEngine/Engagegments/Models/Engagement.php rename to src/Domains/ActionEngine/Engagements/Models/Engagement.php diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php index dd2f4644e..4ba15a54a 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php @@ -42,11 +42,17 @@ public function lead(): BelongsTo return $this->belongsTo(Lead::class, 'lead_id'); } + /** + * temp relationship to engagement will only work on LeadTaskEngagementItem + */ public function engagementStart(): HasOne { return $this->hasOne(Engagement::class, 'id', 'engagement_start_id'); } + /** + * temp relationship to engagement will only work on LeadTaskEngagementItem + */ public function engagementEnd(): HasOne { return $this->hasOne(Engagement::class, 'id', 'engagement_end_id'); diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php index 4c123e7de..7babf7971 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php @@ -7,7 +7,9 @@ use Baka\Casts\Json; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasOne; use Kanvas\ActionEngine\Actions\Models\CompanyAction; +use Kanvas\ActionEngine\Engagements\Models\Engagement; use Kanvas\ActionEngine\Models\BaseModel; /** @@ -41,4 +43,9 @@ public function action(): BelongsTo { return $this->belongsTo(CompanyAction::class, 'companies_action_id'); } + + public function engagementStart(): HasOne + { + return $this->hasOne(Engagement::class, 'id', 'engagement_start_id'); + } } From 972b417d60252f02996604bdb6edd0f9c1c290c9 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 18:39:14 -0400 Subject: [PATCH 060/140] refact: id --- .../Engagements/TaskEngagementBuilder.php | 2 +- ...8_173343_company_task_engagement_items.php | 20 +++++++++---------- .../Tasks/Models/TaskEngagementItem.php | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php index aa3b132c8..986ec202e 100644 --- a/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php +++ b/app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.php @@ -27,7 +27,7 @@ public function getLeadTaskItems( $leadId = $lead->getId(); return TaskListItem::leftJoin('company_task_engagement_items', function ($join) use ($lead) { - $join->on('company_task_list_items.task_list_id', '=', 'company_task_engagement_items.task_list_id') + $join->on('company_task_list_items.id', '=', 'company_task_engagement_items.task_list_item_id') ->where('company_task_engagement_items.lead_id', '=', $lead->getId()); }) ->select( diff --git a/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php index 1c7a4a5b7..256487a49 100644 --- a/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php +++ b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php @@ -11,7 +11,7 @@ public function up(): void { Schema::create('company_task_engagement_items', function (Blueprint $table) { - $table->bigInteger('task_list_id')->index(); + $table->bigInteger('task_list_item_id')->index(); $table->bigInteger('lead_id')->index(); $table->bigInteger('companies_id')->index(); $table->bigInteger('apps_id')->index(); @@ -23,15 +23,15 @@ public function up(): void $table->timestamps(); $table->tinyInteger('is_deleted')->default(0)->index(); - $table->primary(['task_list_id', 'lead_id']); - $table->index(['task_list_id', 'lead_id', 'companies_id'], 'task_list_company_index'); - $table->index(['task_list_id', 'lead_id', 'apps_id'], 'task_list_apps_index'); - $table->index(['task_list_id', 'lead_id', 'users_id'], 'task_list_users_index'); - $table->index(['task_list_id', 'lead_id', 'engagement_start_id'], 'task_list_engagement_start_index'); - $table->index(['task_list_id', 'lead_id', 'engagement_end_id'], 'task_list_engagement_end_index'); - $table->index(['task_list_id', 'lead_id', 'apps_id', 'companies_id'], 'task_list_apps_company_index'); - $table->index(['task_list_id', 'lead_id', 'status'], 'task_list_status_index'); - $table->index(['task_list_id', 'lead_id', 'is_deleted'], 'task_list_deleted_index'); + $table->primary(['task_list_item_id', 'lead_id']); + $table->index(['task_list_item_id', 'lead_id', 'companies_id'], 'task_list_company_index'); + $table->index(['task_list_item_id', 'lead_id', 'apps_id'], 'task_list_apps_index'); + $table->index(['task_list_item_id', 'lead_id', 'users_id'], 'task_list_users_index'); + $table->index(['task_list_item_id', 'lead_id', 'engagement_start_id'], 'task_list_engagement_start_index'); + $table->index(['task_list_item_id', 'lead_id', 'engagement_end_id'], 'task_list_engagement_end_index'); + $table->index(['task_list_item_id', 'lead_id', 'apps_id', 'companies_id'], 'task_list_apps_company_index'); + $table->index(['task_list_item_id', 'lead_id', 'status'], 'task_list_status_index'); + $table->index(['task_list_item_id', 'lead_id', 'is_deleted'], 'task_list_deleted_index'); }); } diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php index 4ba15a54a..8c3bb4549 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php @@ -14,7 +14,7 @@ /** * Class TaskEngagementItem. * - * @property int $task_list_id + * @property int $task_list_item_id * @property int $lead_id * @property int $companies_id * @property int $apps_id @@ -34,7 +34,7 @@ class TaskEngagementItem extends BaseModel public function item(): BelongsTo { - return $this->belongsTo(TaskListItem::class, 'task_list_id'); + return $this->belongsTo(TaskListItem::class, 'task_list_item_id'); } public function lead(): BelongsTo From 436f8f53bc7b2abe098596042c16f6107311b366 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 19:20:07 -0400 Subject: [PATCH 061/140] feat: add test --- .../GraphQL/ActionEngine/CompanyTaskTest.php | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tests/GraphQL/ActionEngine/CompanyTaskTest.php diff --git a/tests/GraphQL/ActionEngine/CompanyTaskTest.php b/tests/GraphQL/ActionEngine/CompanyTaskTest.php new file mode 100644 index 000000000..f0eb7180c --- /dev/null +++ b/tests/GraphQL/ActionEngine/CompanyTaskTest.php @@ -0,0 +1,95 @@ +user(); + $branch = $user->getCurrentBranch(); + $title = fake()->title(); + + if (empty($input)) { + $input = [ + 'branch_id' => $branch->getId(), + 'title' => $title, + 'pipeline_stage_id' => 0, + 'people' => [ + 'firstname' => fake()->firstName(), + 'lastname' => fake()->lastName(), + 'contacts' => [ + [ + 'value' => fake()->email(), + 'contacts_types_id' => 1, + 'weight' => 0, + ], + ], + 'address' => [ + [ + 'address' => fake()->address(), + 'city' => fake()->city(), + 'state' => fake()->state(), + 'country' => fake()->country(), + 'zip' => fake()->postcode(), + ], + ], + ], + 'custom_fields' => [], + 'files' => [ + [ + 'url' => 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', + 'name' => 'dummy.pdf', + ], + ], + ]; + } + + return $this->graphQL(' + mutation($input: LeadInput!) { + createLead(input: $input) { + id + uuid + people { + id + }, + systemModule{ + id + } + } + } + ', [ + 'input' => $input, + ])->json(); + } + + public function testGetLeadTaskEngagement() + { + $lead = $this->createLeadAndGetResponse(); + $leadId = $lead['data']['createLead']['id']; + + $this->graphQL(' + query leadTasks($lead_id: ID!) { + leadTaskItems(lead_id: $lead_id) { + data { + name + action { + name + } + status + config + engagement_start { + uuid + } + } + } + } + ', [ + 'lead_id' => $leadId, // Passing the lead ID to the GraphQL query + ])->assertOk(); + } +} From 66f6a410dd2d11a9a0dce6723b244114bfc6888e Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 8 Jun 2024 23:12:32 -0400 Subject: [PATCH 062/140] refact: migration and response --- ...024_06_08_173343_company_task_engagement_items.php | 6 +++--- .../ActionEngine/Tasks/Models/TaskEngagementItem.php | 6 ------ .../ActionEngine/Tasks/Models/TaskListItem.php | 11 +++++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php index 256487a49..7e6c13fb1 100644 --- a/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php +++ b/database/migrations/ActionEngine/2024_06_08_173343_company_task_engagement_items.php @@ -17,9 +17,9 @@ public function up(): void $table->bigInteger('apps_id')->index(); $table->bigInteger('users_id')->index(); $table->enum('status', ['pending', 'in_progress', 'completed'])->default('pending')->comment('pending, in_progress, completed')->index(); - $table->bigInteger('engagement_start_id')->index(); - $table->bigInteger('engagement_end_id')->index(); - $table->json('config'); + $table->bigInteger('engagement_start_id')->nullable()->index(); + $table->bigInteger('engagement_end_id')->nullable()->index(); + $table->json('config')->nullable(); $table->timestamps(); $table->tinyInteger('is_deleted')->default(0)->index(); diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php index 8c3bb4549..423403adf 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php @@ -42,17 +42,11 @@ public function lead(): BelongsTo return $this->belongsTo(Lead::class, 'lead_id'); } - /** - * temp relationship to engagement will only work on LeadTaskEngagementItem - */ public function engagementStart(): HasOne { return $this->hasOne(Engagement::class, 'id', 'engagement_start_id'); } - /** - * temp relationship to engagement will only work on LeadTaskEngagementItem - */ public function engagementEnd(): HasOne { return $this->hasOne(Engagement::class, 'id', 'engagement_end_id'); diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php index 7babf7971..711860b58 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php @@ -44,8 +44,19 @@ public function action(): BelongsTo return $this->belongsTo(CompanyAction::class, 'companies_action_id'); } + /** + * temp relationship to engagement will only work on LeadTaskEngagementItem + */ public function engagementStart(): HasOne { return $this->hasOne(Engagement::class, 'id', 'engagement_start_id'); } + + /** + * temp relationship to engagement will only work on LeadTaskEngagementItem + */ + public function engagementEnd(): HasOne + { + return $this->hasOne(Engagement::class, 'id', 'engagement_end_id'); + } } From 793ae16b9ca4bf71041cbbd0be0b3ae4bd7c908c Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 9 Jun 2024 16:57:16 -0400 Subject: [PATCH 063/140] refact: created at --- graphql/schemas/ActionEngine/task.graphql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index d07fbfc58..7df35b3b6 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -24,8 +24,8 @@ type LeadTaskEngagementItem { config: Mixed engagement_start: Engagement @hasOne(relation: "engagementStart") engagement_end: Engagement @hasOne(relation: "engagementEnd") - created_at: DateTime! - updated_at: DateTime! + created_at: DateTime + updated_at: DateTime } extend type Query @guard { From 625c1df534611c302402b7911ed86c80f68e3cc7 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 9 Jun 2024 17:24:39 -0400 Subject: [PATCH 064/140] refact: created at --- graphql/schemas/ActionEngine/action.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/schemas/ActionEngine/action.graphql b/graphql/schemas/ActionEngine/action.graphql index 7070d69d8..0ce94cf87 100644 --- a/graphql/schemas/ActionEngine/action.graphql +++ b/graphql/schemas/ActionEngine/action.graphql @@ -21,7 +21,7 @@ type CompanyAction { name: String! description: String form_config: Mixed - status: String! + status: String is_active: Boolean! is_published: Boolean! weight: Float! From 2b438f63924c3b487127f4cf2dc98fd45c36dc70 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 9 Jun 2024 18:52:16 -0400 Subject: [PATCH 065/140] refact: graph --- graphql/schemas/ActionEngine/task.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index 7df35b3b6..d6bf622da 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -19,7 +19,7 @@ type TaskListItem { type LeadTaskEngagementItem { name: String! - action: CompanyAction! @belongsTo + company_action: CompanyAction! @belongsTo status: String config: Mixed engagement_start: Engagement @hasOne(relation: "engagementStart") From 2e55d78e45a690eb54c3949f5150944e9fce4085 Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 10 Jun 2024 09:33:03 -0400 Subject: [PATCH 066/140] refact: relationship --- graphql/schemas/ActionEngine/task.graphql | 2 +- src/Domains/ActionEngine/Tasks/Models/TaskListItem.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index d6bf622da..eec8fe747 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -19,7 +19,7 @@ type TaskListItem { type LeadTaskEngagementItem { name: String! - company_action: CompanyAction! @belongsTo + company_action: CompanyAction! @belongsTo(relation: "companyAction") status: String config: Mixed engagement_start: Engagement @hasOne(relation: "engagementStart") diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php index 711860b58..20149b039 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskListItem.php @@ -39,7 +39,7 @@ public function task(): BelongsTo return $this->belongsTo(TaskList::class, 'task_list_id'); } - public function action(): BelongsTo + public function companyAction(): BelongsTo { return $this->belongsTo(CompanyAction::class, 'companies_action_id'); } From 5ba20fb7da4d966d48b45a3810783e12486e58cc Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 10 Jun 2024 10:44:44 -0400 Subject: [PATCH 067/140] refact: test --- tests/GraphQL/ActionEngine/CompanyTaskTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/GraphQL/ActionEngine/CompanyTaskTest.php b/tests/GraphQL/ActionEngine/CompanyTaskTest.php index f0eb7180c..de1a7f140 100644 --- a/tests/GraphQL/ActionEngine/CompanyTaskTest.php +++ b/tests/GraphQL/ActionEngine/CompanyTaskTest.php @@ -77,13 +77,26 @@ public function testGetLeadTaskEngagement() leadTaskItems(lead_id: $lead_id) { data { name - action { + company_action { name + action { + slug + } } status config engagement_start { uuid + message { + message + } + lead { + title + } + slug + entity_uuid + } engagement_end { + uuid } } } From 41b6c841a2f0ad1471059f874a2e3419623b28dc Mon Sep 17 00:00:00 2001 From: Rafael White Date: Mon, 10 Jun 2024 17:00:41 -0400 Subject: [PATCH 068/140] disable deploy to kubernetes cluster --- .github/workflows/deploy.yml | 1 - .github/workflows/ec2-deploy.yaml | 4 ++++ development.Dockerfile | 11 ++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 10020d0d3..31bae8771 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,6 @@ on: push: branches: - '1.x' - - 'development' workflow_dispatch: diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 0d52c46a2..5bdeeb758 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -1,6 +1,10 @@ name: Deploy to EC2 on: + push: + branches: + - 'development' + workflow_dispatch: jobs: diff --git a/development.Dockerfile b/development.Dockerfile index 53ed9c687..1b7868376 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -1,4 +1,9 @@ -FROM unit:php8.3 +FROM --platform=linux/arm64 unit:php8.3 + +# # Define a build argument for the target architecture +# ARG TARGETARCH +# # Set an environment variable to use the architecture in commands +# ENV ARCH=$TARGETARCH COPY ./docker/unit.json /docker-entrypoint.d/ @@ -39,8 +44,6 @@ COPY . /app # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install --optimize-autoloader - # add root to www group # RUN chmod -R ug+w var/www/html/storage @@ -51,4 +54,6 @@ RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini WORKDIR /var/www/html/ +RUN composer install --optimize-autoloader + EXPOSE 8080 \ No newline at end of file From a4e767b240f16c45e7e4db6b1cbac2ccd51284e0 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Mon, 10 Jun 2024 17:01:39 -0400 Subject: [PATCH 069/140] remove version of docker compose file, not necessary --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d06e1815c..74a3129b3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3' services: php: container_name: php${APP_CONTAINER_NAME} From 51ef8baf11cec3d3532ff44cfcfebfd32e69a1cf Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 10 Jun 2024 21:18:31 -0400 Subject: [PATCH 070/140] refact: create tags --- src/Domains/Social/Tags/Actions/CreateTagAction.php | 5 +++-- src/Domains/Social/Tags/DataTransferObjects/Tag.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Domains/Social/Tags/Actions/CreateTagAction.php b/src/Domains/Social/Tags/Actions/CreateTagAction.php index d9829b0a5..2b10c29ea 100644 --- a/src/Domains/Social/Tags/Actions/CreateTagAction.php +++ b/src/Domains/Social/Tags/Actions/CreateTagAction.php @@ -9,8 +9,9 @@ class CreateTagAction { - public function __construct(private TagData $tagData) - { + public function __construct( + protected TagData $tagData + ) { } public function execute(): Tag diff --git a/src/Domains/Social/Tags/DataTransferObjects/Tag.php b/src/Domains/Social/Tags/DataTransferObjects/Tag.php index 26578b56e..a93110042 100644 --- a/src/Domains/Social/Tags/DataTransferObjects/Tag.php +++ b/src/Domains/Social/Tags/DataTransferObjects/Tag.php @@ -17,7 +17,7 @@ public function __construct( public Companies $company, public string $name, public ?string $slug = null, - public ?int $weight = null + public ?int $weight = 0 ) { } } From 95c892e34bd7a062b509988a61516b07b8e1e248 Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 10 Jun 2024 21:19:23 -0400 Subject: [PATCH 071/140] refact: create tags --- src/Domains/Social/Tags/DataTransferObjects/Tag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Social/Tags/DataTransferObjects/Tag.php b/src/Domains/Social/Tags/DataTransferObjects/Tag.php index a93110042..dd41a0fd9 100644 --- a/src/Domains/Social/Tags/DataTransferObjects/Tag.php +++ b/src/Domains/Social/Tags/DataTransferObjects/Tag.php @@ -17,7 +17,7 @@ public function __construct( public Companies $company, public string $name, public ?string $slug = null, - public ?int $weight = 0 + public int $weight = 0 ) { } } From 4b7082a7b4d6292bd473ee2ee2e8061928b934e4 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Mon, 10 Jun 2024 22:24:44 -0400 Subject: [PATCH 072/140] refactor: create tag fix weight --- src/Domains/Social/Tags/Actions/CreateTagAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Social/Tags/Actions/CreateTagAction.php b/src/Domains/Social/Tags/Actions/CreateTagAction.php index 2b10c29ea..82f152441 100644 --- a/src/Domains/Social/Tags/Actions/CreateTagAction.php +++ b/src/Domains/Social/Tags/Actions/CreateTagAction.php @@ -22,7 +22,7 @@ public function execute(): Tag 'name' => $this->tagData->name, ], [ 'users_id' => $this->tagData->user?->getId(), - 'weight' => $this->tagData->weight, + 'weight' => $this->tagData->weight ?? 0, ]); } } From 959c5e03a698c0240e454f1adff9c160f1fe2d13 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 11 Jun 2024 14:34:09 -0400 Subject: [PATCH 073/140] add channels update into variant update input --- graphql/schemas/Inventory/variant.graphql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index 117539de4..377a83550 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -90,6 +90,8 @@ input VariantsUpdateInput { serial_number: String is_published: Boolean warehouses: [WarehouseReferenceInput!] + channels: [VariantChannelReferenceInput!] + custom_fields: [CustomFieldEntityInput!] } extend type Mutation @guard { From 72ad0edf5cb72715e508f7070447bf12c7c1fcab Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 11 Jun 2024 14:34:40 -0400 Subject: [PATCH 074/140] use channel service to update channel data --- app/GraphQL/Inventory/Mutations/Variants/Variants.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/GraphQL/Inventory/Mutations/Variants/Variants.php b/app/GraphQL/Inventory/Mutations/Variants/Variants.php index 2e7faf7e7..e5b5deaed 100644 --- a/app/GraphQL/Inventory/Mutations/Variants/Variants.php +++ b/app/GraphQL/Inventory/Mutations/Variants/Variants.php @@ -5,8 +5,8 @@ namespace App\GraphQL\Inventory\Mutations\Variants; use Kanvas\Inventory\Attributes\Repositories\AttributesRepository; -use Kanvas\Inventory\Channels\Models\Channels; use Kanvas\Inventory\Channels\Repositories\ChannelRepository; +use Kanvas\Inventory\Channels\Services\ChannelService; use Kanvas\Inventory\Status\Repositories\StatusRepository; use Kanvas\Inventory\Variants\Actions\AddAttributeAction; use Kanvas\Inventory\Variants\Actions\AddToWarehouseAction as AddToWarehouse; @@ -116,6 +116,10 @@ public function update(mixed $root, array $req): VariantModel WarehouseService::updateWarehouseVariant($variantModel, auth()->user(), $req['input']['warehouses']); } + if (isset($req['input']['channels'])) { + ChannelService::updateChannelVariant($variantModel, $req['input']['channels']); + } + return $variantModel; } From c9ab6f3e588106b1f92c0001343490f229ac7458 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 11 Jun 2024 14:36:20 -0400 Subject: [PATCH 075/140] create channel service to update channel variant --- .../Channels/Services/ChannelService.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Domains/Inventory/Channels/Services/ChannelService.php diff --git a/src/Domains/Inventory/Channels/Services/ChannelService.php b/src/Domains/Inventory/Channels/Services/ChannelService.php new file mode 100644 index 000000000..f7e351f09 --- /dev/null +++ b/src/Domains/Inventory/Channels/Services/ChannelService.php @@ -0,0 +1,37 @@ +variantChannels()->forcedelete(); + foreach ($variantsChannels as $variantChannel) { + $warehouse = WarehouseRepository::getById((int) $variantChannel['warehouses_id']); + $channel = ChannelRepository::getById((int) $variantChannel['channels_id'],$variant->product->company()->get()->first()); + $variantChannelDto = VariantChannel::from($variantChannel); + + VariantService::addVariantChannel( + $variant, + $warehouse, + $channel, + $variantChannelDto + ); + } + + return $variant; + } + +} From 4364cb9212c657ac0a680f1f98bcd212931b41d9 Mon Sep 17 00:00:00 2001 From: arfenis Date: Tue, 11 Jun 2024 14:38:24 -0400 Subject: [PATCH 076/140] stylo --- src/Domains/Inventory/Channels/Services/ChannelService.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Domains/Inventory/Channels/Services/ChannelService.php b/src/Domains/Inventory/Channels/Services/ChannelService.php index f7e351f09..7c44c26ff 100644 --- a/src/Domains/Inventory/Channels/Services/ChannelService.php +++ b/src/Domains/Inventory/Channels/Services/ChannelService.php @@ -20,7 +20,7 @@ public static function updateChannelVariant(Variants $variant, array $variantsCh $variant->variantChannels()->forcedelete(); foreach ($variantsChannels as $variantChannel) { $warehouse = WarehouseRepository::getById((int) $variantChannel['warehouses_id']); - $channel = ChannelRepository::getById((int) $variantChannel['channels_id'],$variant->product->company()->get()->first()); + $channel = ChannelRepository::getById((int) $variantChannel['channels_id'], $variant->product->company()->get()->first()); $variantChannelDto = VariantChannel::from($variantChannel); VariantService::addVariantChannel( @@ -33,5 +33,4 @@ public static function updateChannelVariant(Variants $variant, array $variantsCh return $variant; } - } From f39a96043be8fa471009ea21f817052c0ed66b88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:01:27 +0000 Subject: [PATCH 077/140] build(deps): bump nuwave/lighthouse from 6.36.3 to 6.37.0 Bumps [nuwave/lighthouse](https://github.com/nuwave/lighthouse) from 6.36.3 to 6.37.0. - [Release notes](https://github.com/nuwave/lighthouse/releases) - [Changelog](https://github.com/nuwave/lighthouse/blob/master/CHANGELOG.md) - [Commits](https://github.com/nuwave/lighthouse/compare/v6.36.3...v6.37.0) --- updated-dependencies: - dependency-name: nuwave/lighthouse dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.lock b/composer.lock index 6d1cf799e..21da7a253 100644 --- a/composer.lock +++ b/composer.lock @@ -6381,16 +6381,16 @@ }, { "name": "nuwave/lighthouse", - "version": "v6.36.3", + "version": "v6.37.0", "source": { "type": "git", "url": "https://github.com/nuwave/lighthouse.git", - "reference": "dc3125d6b29da7552dfcf61dc5470aedc1cc533a" + "reference": "7f9a6d844ab8ce83f50805973a6bb066e449f953" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/dc3125d6b29da7552dfcf61dc5470aedc1cc533a", - "reference": "dc3125d6b29da7552dfcf61dc5470aedc1cc533a", + "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/7f9a6d844ab8ce83f50805973a6bb066e449f953", + "reference": "7f9a6d844ab8ce83f50805973a6bb066e449f953", "shasum": "" }, "require": { @@ -6427,7 +6427,7 @@ "mll-lab/php-cs-fixer-config": "^5", "mockery/mockery": "^1.5", "nesbot/carbon": "^2.62.1", - "orchestra/testbench": "^7.7 || ^8.8 || ^9", + "orchestra/testbench": "^7.11 || ^8.8 || ^9", "phpbench/phpbench": "^1.2.6", "phpstan/extension-installer": "^1", "phpstan/phpstan": "^1.10.3", @@ -6511,7 +6511,7 @@ "type": "patreon" } ], - "time": "2024-05-05T09:15:52+00:00" + "time": "2024-06-11T09:58:58+00:00" }, { "name": "nyholm/psr7", @@ -13446,16 +13446,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.11.1", + "version": "v15.12.1", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "ab4ff2719b101dc3bfc3aaaf800edc21a98c56dc" + "reference": "d8ea59bb02af10fd58a1192f7a781ae8aedac2d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/ab4ff2719b101dc3bfc3aaaf800edc21a98c56dc", - "reference": "ab4ff2719b101dc3bfc3aaaf800edc21a98c56dc", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/d8ea59bb02af10fd58a1192f7a781ae8aedac2d6", + "reference": "d8ea59bb02af10fd58a1192f7a781ae8aedac2d6", "shasum": "" }, "require": { @@ -13468,14 +13468,14 @@ "amphp/http-server": "^2.1", "dms/phpunit-arraysubset-asserts": "dev-master", "ergebnis/composer-normalize": "^2.28", - "friendsofphp/php-cs-fixer": "3.51.0", + "friendsofphp/php-cs-fixer": "3.58.1", "mll-lab/php-cs-fixer-config": "^5", "nyholm/psr7": "^1.5", "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "1.10.59", - "phpstan/phpstan-phpunit": "1.3.16", - "phpstan/phpstan-strict-rules": "1.5.2", + "phpstan/phpstan": "1.11.4", + "phpstan/phpstan-phpunit": "1.4.0", + "phpstan/phpstan-strict-rules": "1.6.0", "phpunit/phpunit": "^9.5 || ^10", "psr/http-message": "^1 || ^2", "react/http": "^1.6", @@ -13508,7 +13508,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.11.1" + "source": "https://github.com/webonyx/graphql-php/tree/v15.12.1" }, "funding": [ { @@ -13516,7 +13516,7 @@ "type": "open_collective" } ], - "time": "2024-03-11T10:21:05+00:00" + "time": "2024-06-11T12:48:47+00:00" } ], "packages-dev": [ From ee4aa77e89772facb112c855c10fe60d16f15d96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:01:36 +0000 Subject: [PATCH 078/140] build(deps): bump sentry/sentry-laravel from 4.5.1 to 4.6.0 Bumps [sentry/sentry-laravel](https://github.com/getsentry/sentry-laravel) from 4.5.1 to 4.6.0. - [Release notes](https://github.com/getsentry/sentry-laravel/releases) - [Changelog](https://github.com/getsentry/sentry-laravel/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-laravel/compare/4.5.1...4.6.0) --- updated-dependencies: - dependency-name: sentry/sentry-laravel 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 6d1cf799e..5c37680bf 100644 --- a/composer.lock +++ b/composer.lock @@ -8667,16 +8667,16 @@ }, { "name": "sentry/sentry-laravel", - "version": "4.5.1", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "a15b2f5fa7b446f006eb93134e237c38a11776cf" + "reference": "75c11944211ce7707bb92e717c5bda93a1759438" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/a15b2f5fa7b446f006eb93134e237c38a11776cf", - "reference": "a15b2f5fa7b446f006eb93134e237c38a11776cf", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/75c11944211ce7707bb92e717c5bda93a1759438", + "reference": "75c11944211ce7707bb92e717c5bda93a1759438", "shasum": "" }, "require": { @@ -8740,7 +8740,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/4.5.1" + "source": "https://github.com/getsentry/sentry-laravel/tree/4.6.0" }, "funding": [ { @@ -8752,7 +8752,7 @@ "type": "custom" } ], - "time": "2024-04-24T08:58:34+00:00" + "time": "2024-06-11T12:23:24+00:00" }, { "name": "shopify/shopify-api", From 3bf5a214d46ff6082399b2dd0747f529bcf3d5a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:01:44 +0000 Subject: [PATCH 079/140] build(deps-dev): bump phpunit/phpunit from 11.2.0 to 11.2.1 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.2.0 to 11.2.1. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/11.2.1/ChangeLog-11.2.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/11.2.0...11.2.1) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development 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 6d1cf799e..d6671a4c7 100644 --- a/composer.lock +++ b/composer.lock @@ -14522,16 +14522,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.0", + "version": "11.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "705eba0190afe04bc057f565ad843267717cf109" + "reference": "1b8775732e9c401bda32df3ffbdf90dec7533ceb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/705eba0190afe04bc057f565ad843267717cf109", - "reference": "705eba0190afe04bc057f565ad843267717cf109", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b8775732e9c401bda32df3ffbdf90dec7533ceb", + "reference": "1b8775732e9c401bda32df3ffbdf90dec7533ceb", "shasum": "" }, "require": { @@ -14602,7 +14602,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.1" }, "funding": [ { @@ -14618,7 +14618,7 @@ "type": "tidelift" } ], - "time": "2024-06-07T04:48:50+00:00" + "time": "2024-06-11T07:30:35+00:00" }, { "name": "sebastian/cli-parser", From ee4df9263c921288b2a27e600218e2d893654a9f Mon Sep 17 00:00:00 2001 From: kaioken Date: Tue, 11 Jun 2024 23:29:12 -0400 Subject: [PATCH 080/140] refact: people tags --- .../Peoples/PeopleManagementMutation.php | 2 + graphql/schemas/Guild/people.graphql | 1 + .../Customers/DataTransferObject/People.php | 1 + .../Customers/Factories/PeopleFactory.php | 20 ++++- .../Customers/Jobs/CustomerImporterJob.php | 1 + src/Domains/Guild/Customers/Models/People.php | 3 + .../Social/Tags/Traits/HasTagsTrait.php | 88 +++++++++++++++++++ tests/Social/Integration/TagsTest.php | 84 ++++++++++++++++++ 8 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 src/Domains/Social/Tags/Traits/HasTagsTrait.php create mode 100644 tests/Social/Integration/TagsTest.php diff --git a/app/GraphQL/Guild/Mutations/Peoples/PeopleManagementMutation.php b/app/GraphQL/Guild/Mutations/Peoples/PeopleManagementMutation.php index 93c94ac54..6f88fe7ec 100644 --- a/app/GraphQL/Guild/Mutations/Peoples/PeopleManagementMutation.php +++ b/app/GraphQL/Guild/Mutations/Peoples/PeopleManagementMutation.php @@ -39,6 +39,7 @@ public function create(mixed $root, array $req): ModelsPeople 'google_contact_id' => $data['google_contact_id'] ?? null, 'apple_contact_id' => $data['apple_contact_id'] ?? null, 'linkedin_contact_id' => $data['linkedin_contact_id'] ?? null, + 'tags' => $data['tags'] ?? [], 'custom_fields' => $data['custom_fields'] ?? [], ]); @@ -69,6 +70,7 @@ public function update(mixed $root, array $req): ModelsPeople 'google_contact_id' => $data['google_contact_id'] ?? null, 'apple_contact_id' => $data['apple_contact_id'] ?? null, 'linkedin_contact_id' => $data['linkedin_contact_id'] ?? null, + 'tags' => $data['tags'] ?? [], 'custom_fields' => $data['custom_fields'] ?? [], ]); diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index fa46f37be..283d7a6c1 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -48,6 +48,7 @@ input PeopleInput { address: [AddressInput!] files: [FilesystemInputUrl!] custom_fields: [CustomFieldEntityInput!] + tags: [TagInput!] created_at: DateTime } diff --git a/src/Domains/Guild/Customers/DataTransferObject/People.php b/src/Domains/Guild/Customers/DataTransferObject/People.php index 4c0f4fcda..15da6d8de 100644 --- a/src/Domains/Guild/Customers/DataTransferObject/People.php +++ b/src/Domains/Guild/Customers/DataTransferObject/People.php @@ -38,6 +38,7 @@ public function __construct( public readonly ?string $linkedin_contact_id = null, public readonly ?string $middlename = null, public readonly array $custom_fields = [], + public readonly array $tags = [], public readonly ?string $created_at = null ) { } diff --git a/src/Domains/Guild/Customers/Factories/PeopleFactory.php b/src/Domains/Guild/Customers/Factories/PeopleFactory.php index 4ea6858cf..fe10e4912 100644 --- a/src/Domains/Guild/Customers/Factories/PeopleFactory.php +++ b/src/Domains/Guild/Customers/Factories/PeopleFactory.php @@ -5,7 +5,6 @@ namespace Kanvas\Guild\Customers\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Kanvas\Enums\AppEnums; use Kanvas\Guild\Customers\Models\People; class PeopleFactory extends Factory @@ -18,8 +17,25 @@ public function definition() 'firstname' => fake()->firstName, 'lastname' => fake()->lastName, 'name' => fake()->name, - 'companies_id' => AppEnums::GLOBAL_COMPANY_ID->getValue(), 'users_id' => 1, ]; } + + public function withAppId(int $appId) + { + return $this->state(function (array $attributes) use ($appId) { + return [ + 'apps_id' => $appId, + ]; + }); + } + + public function withCompanyId(int $companyId) + { + return $this->state(function (array $attributes) use ($companyId) { + return [ + 'companies_id' => $companyId, + ]; + }); + } } diff --git a/src/Domains/Guild/Customers/Jobs/CustomerImporterJob.php b/src/Domains/Guild/Customers/Jobs/CustomerImporterJob.php index c59ad3871..4d8507662 100644 --- a/src/Domains/Guild/Customers/Jobs/CustomerImporterJob.php +++ b/src/Domains/Guild/Customers/Jobs/CustomerImporterJob.php @@ -101,6 +101,7 @@ public function handle() 'apple_contact_id' => $customerData['apple_contact_id'] ?? null, 'linkedin_contact_id' => $customerData['linkedin_contact_id'] ?? null, 'custom_fields' => $customerData['custom_fields'] ?? [], + 'tags' => $customerData['tags'] ?? [], 'created_at' => $customerData['created_at'] ?? null, ]); diff --git a/src/Domains/Guild/Customers/Models/People.php b/src/Domains/Guild/Customers/Models/People.php index 55af8b428..4e6163897 100644 --- a/src/Domains/Guild/Customers/Models/People.php +++ b/src/Domains/Guild/Customers/Models/People.php @@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\Guild\Customers\Factories\PeopleFactory; use Kanvas\Guild\Models\BaseModel; +use Kanvas\Social\Tags\Traits\HasTagsTrait; use Laravel\Scout\Searchable; /** @@ -17,6 +18,7 @@ * * @property int $id * @property string $uuid + * @property int $apps_id * @property int $users_id * @property int $companies_id * @property string $name @@ -35,6 +37,7 @@ class People extends BaseModel { use UuidTrait; use Searchable; + use HasTagsTrait; protected $table = 'peoples'; protected $guarded = []; diff --git a/src/Domains/Social/Tags/Traits/HasTagsTrait.php b/src/Domains/Social/Tags/Traits/HasTagsTrait.php new file mode 100644 index 000000000..2965b8414 --- /dev/null +++ b/src/Domains/Social/Tags/Traits/HasTagsTrait.php @@ -0,0 +1,88 @@ +morphToMany(ModelsTag::class, 'taggable', $dbConnection . '.tags_entities', 'tags_id', 'entity_id') + ->using(TagEntity::class) + ->wherePivot('apps_id', $this->apps_id); + + if ($userCompany) { + $query->wherePivot('companies_id', $this->companies_id); + } + + return $query; + } + + public function addTag( + string $tag, + ?AppInterface $app = null, + ?UserInterface $user = null, + ?CompanyInterface $company = null + ): void { + $app = $this->app ?? $app; + $user = $this->user ?? $user; + $company = $company ?? $this->company; + + $tag = (new CreateTagAction( + new Tag( + $app, + $user, + $company, + $tag + ) + ))->execute(); + + $this->tags()->attach($tag->getId(), [ + 'entity_namespace' => self::class, + 'companies_id' => $company->getId(), + 'apps_id' => $app->getId(), + 'users_id' => $user->getId(), + 'taggable_type' => ModelsTag::class, + 'is_deleted' => 0, + ]); + } + + public function addTags( + array $tags, + ?AppInterface $app = null, + ?UserInterface $user = null, + ?CompanyInterface $company = null + ): void { + foreach ($tags as $tag) { + $this->addTag($tag, $app, $user, $company); + } + } + + public function removeTag(string $tag): void + { + $this->tags()->where('name', $tag)->delete(); + } + + public function removeTags(array $tags): void + { + $this->tags()->whereIn('name', $tags)->delete(); + } + + public function syncTags(array $tags): void + { + $this->tags()->detach(); + $this->addTags($tags); + } +} diff --git a/tests/Social/Integration/TagsTest.php b/tests/Social/Integration/TagsTest.php new file mode 100644 index 000000000..99f1d3fe3 --- /dev/null +++ b/tests/Social/Integration/TagsTest.php @@ -0,0 +1,84 @@ +user()->getCurrentCompany(); + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + + $people->addTag('test'); + + $this->assertNotEmpty($people->tags()->get()); + $this->assertCount(1, $people->tags()->get()); + } + + public function testAddMultipleTagsToEntity(): void + { + $app = app(Apps::class); + $company = auth()->user()->getCurrentCompany(); + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + + $people->addTags(['test', 'test2']); + + $this->assertNotEmpty($people->tags()->get()); + $this->assertCount(2, $people->tags()->get()); + } + + public function testRemoveTagFromEntity(): void + { + $app = app(Apps::class); + $company = auth()->user()->getCurrentCompany(); + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + + $people->addTag('test'); + $people->addTag('test2'); + + $this->assertCount(2, $people->tags()->get()); + + $people->removeTag('test'); + + $this->assertCount(1, $people->tags()->get()); + } + + public function testRemoveTagsFromEntity(): void + { + $app = app(Apps::class); + $company = auth()->user()->getCurrentCompany(); + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + + $people->addTag('test'); + $people->addTag('test2'); + + $this->assertCount(2, $people->tags()->get()); + + $people->removeTags(['test', 'test2']); + + $this->assertCount(0, $people->tags()->get()); + } + + public function testSyncTagsFromEntity(): void + { + $app = app(Apps::class); + $company = auth()->user()->getCurrentCompany(); + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + + $people->addTag('test'); + $people->addTag('test2'); + + $this->assertCount(2, $people->tags()->get()); + + $people->syncTags(['test3', 'test4']); + + $this->assertCount(2, $people->tags()->get()); + } +} From 38f60e426079a09d57e0270df2106298f7863bce Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:01:13 -0400 Subject: [PATCH 081/140] refact: entity tags --- .../Social/2024_06_05_154618_tags_entities.php | 2 +- .../Guild/Customers/Actions/CreatePeopleAction.php | 4 ++++ .../Guild/Customers/Actions/UpdatePeopleAction.php | 5 ++++- src/Domains/Inventory/Products/Models/Products.php | 2 ++ src/Domains/Social/Tags/Models/TagEntity.php | 1 + src/Domains/Social/Tags/Traits/HasTagsTrait.php | 10 ++++++---- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/database/migrations/Social/2024_06_05_154618_tags_entities.php b/database/migrations/Social/2024_06_05_154618_tags_entities.php index 3cab1cce3..fcfaf4ab0 100644 --- a/database/migrations/Social/2024_06_05_154618_tags_entities.php +++ b/database/migrations/Social/2024_06_05_154618_tags_entities.php @@ -14,7 +14,7 @@ public function up(): void $table->id(); $table->integer('tags_id')->index(); $table->integer('entity_id')->index(); - $table->string('entity_namespace')->index(); + $table->string('entity_namespace')->index(); //@todo remove $table->integer('companies_id')->index(); $table->integer('apps_id')->index(); $table->integer('users_id')->index(); diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index 566b94d2a..6e0dff3b9 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -57,6 +57,10 @@ public function execute(): People $people->setCustomFields($this->peopleData->custom_fields); $people->saveCustomFields(); + if (count($this->peopleData->tags)) { + $people->addTags(array_column($this->peopleData->tags, 'name')); + } + if ($this->peopleData->contacts->count()) { $existingContacts = $people->contacts()->pluck('value')->toArray(); $contactsToAdd = []; diff --git a/src/Domains/Guild/Customers/Actions/UpdatePeopleAction.php b/src/Domains/Guild/Customers/Actions/UpdatePeopleAction.php index 7bdcb9e06..426019d1a 100644 --- a/src/Domains/Guild/Customers/Actions/UpdatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/UpdatePeopleAction.php @@ -8,7 +8,6 @@ use Kanvas\Guild\Customers\Models\Address; use Kanvas\Guild\Customers\Models\Contact; use Kanvas\Guild\Customers\Models\People; -use Spatie\LaravelData\DataCollection; class UpdatePeopleAction { @@ -43,6 +42,10 @@ public function execute(): People $this->people->setCustomFields($this->peopleData->custom_fields); $this->people->saveCustomFields(); + if (count($this->peopleData->tags)) { + $this->people->syncTags(array_column($this->peopleData->tags, 'name')); + } + if ($this->peopleData->contacts->count()) { $contacts = []; $this->people->contacts()->delete(); diff --git a/src/Domains/Inventory/Products/Models/Products.php b/src/Domains/Inventory/Products/Models/Products.php index bdb1362df..b147782e9 100644 --- a/src/Domains/Inventory/Products/Models/Products.php +++ b/src/Domains/Inventory/Products/Models/Products.php @@ -23,6 +23,7 @@ use Kanvas\Inventory\Variants\Services\VariantService; use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Social\Interactions\Traits\LikableTrait; +use Kanvas\Social\Tags\Traits\HasTagsTrait; use Laravel\Scout\Searchable; /** @@ -50,6 +51,7 @@ class Products extends BaseModel use SlugTrait; use LikableTrait; use HasShopifyCustomField; + use HasTagsTrait; use Searchable { search as public traitSearch; } diff --git a/src/Domains/Social/Tags/Models/TagEntity.php b/src/Domains/Social/Tags/Models/TagEntity.php index 28bf2e7c6..aaacd6c3c 100644 --- a/src/Domains/Social/Tags/Models/TagEntity.php +++ b/src/Domains/Social/Tags/Models/TagEntity.php @@ -16,6 +16,7 @@ class TagEntity extends MorphPivot 'tags_id', 'entity_id', 'entity_namespace', + 'taggable_type', 'companies_id', 'apps_id', 'users_id', diff --git a/src/Domains/Social/Tags/Traits/HasTagsTrait.php b/src/Domains/Social/Tags/Traits/HasTagsTrait.php index 2965b8414..800737345 100644 --- a/src/Domains/Social/Tags/Traits/HasTagsTrait.php +++ b/src/Domains/Social/Tags/Traits/HasTagsTrait.php @@ -19,9 +19,11 @@ public function tags(bool $userCompany = true): MorphToMany { $dbConnection = config('database.connections.social.database'); - $query = $this->morphToMany(ModelsTag::class, 'taggable', $dbConnection . '.tags_entities', 'tags_id', 'entity_id') + $query = $this->morphToMany(ModelsTag::class, 'taggable', $dbConnection . '.tags_entities', 'entity_id', 'tags_id') ->using(TagEntity::class) - ->wherePivot('apps_id', $this->apps_id); + ->wherePivot('apps_id', $this->apps_id) + ->withPivot('entity_namespace', 'companies_id', 'apps_id', 'users_id', 'is_deleted', 'created_at', 'updated_at'); + if ($userCompany) { $query->wherePivot('companies_id', $this->companies_id); @@ -49,12 +51,12 @@ public function addTag( ) ))->execute(); - $this->tags()->attach($tag->getId(), [ + $this->tags()->attach($this->getId(), [ 'entity_namespace' => self::class, 'companies_id' => $company->getId(), 'apps_id' => $app->getId(), + 'tags_id' => $tag->getId(), 'users_id' => $user->getId(), - 'taggable_type' => ModelsTag::class, 'is_deleted' => 0, ]); } From 139f816c0c467843de66c6cb7c884af8a680ba55 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:03:34 -0400 Subject: [PATCH 082/140] refact: qquery tags --- app/GraphQL/Social/Queries/Tags/TagsQueries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GraphQL/Social/Queries/Tags/TagsQueries.php b/app/GraphQL/Social/Queries/Tags/TagsQueries.php index 7b08c6b1a..e9196babb 100644 --- a/app/GraphQL/Social/Queries/Tags/TagsQueries.php +++ b/app/GraphQL/Social/Queries/Tags/TagsQueries.php @@ -18,7 +18,7 @@ public function getTagsBuilder(mixed $root, array $args): mixed return Tag::whereHas('taggables', function ($query) use ($root, $systemModule) { $query->where('entity_id', $root->getKey()); - $query->where('entity_namespace', $systemModule->model_name); + $query->where('taggable_type', $systemModule->model_name); $query->where('apps_id', $systemModule->apps_id); })->where('is_deleted', StateEnums::NO->getValue()); } From 8d309d80b697049abb761add0b2c4f27e8a30812 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:05:36 -0400 Subject: [PATCH 083/140] refact: entity tags --- src/Domains/Social/Tags/Models/TagEntity.php | 4 ++-- src/Domains/Social/Tags/Traits/HasTagsTrait.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Domains/Social/Tags/Models/TagEntity.php b/src/Domains/Social/Tags/Models/TagEntity.php index aaacd6c3c..ae4da96d1 100644 --- a/src/Domains/Social/Tags/Models/TagEntity.php +++ b/src/Domains/Social/Tags/Models/TagEntity.php @@ -27,11 +27,11 @@ class TagEntity extends MorphPivot public function entity() { - return $this->morphTo(null, 'entity_namespace', 'entity_id'); + return $this->morphTo(null, 'taggable_type', 'entity_id'); } public function systemModule(): BelongsTo { - return $this->belongsTo(SystemModules::class, 'entity_namespace', 'model_name')->where('apps_id', $this->apps_id); + return $this->belongsTo(SystemModules::class, 'taggable_type', 'model_name')->where('apps_id', $this->apps_id); } } diff --git a/src/Domains/Social/Tags/Traits/HasTagsTrait.php b/src/Domains/Social/Tags/Traits/HasTagsTrait.php index 800737345..ebfdc6a02 100644 --- a/src/Domains/Social/Tags/Traits/HasTagsTrait.php +++ b/src/Domains/Social/Tags/Traits/HasTagsTrait.php @@ -21,8 +21,7 @@ public function tags(bool $userCompany = true): MorphToMany $query = $this->morphToMany(ModelsTag::class, 'taggable', $dbConnection . '.tags_entities', 'entity_id', 'tags_id') ->using(TagEntity::class) - ->wherePivot('apps_id', $this->apps_id) - ->withPivot('entity_namespace', 'companies_id', 'apps_id', 'users_id', 'is_deleted', 'created_at', 'updated_at'); + ->wherePivot('apps_id', $this->apps_id); if ($userCompany) { From 2212214b3fb8357922d36bd21d1c4fcdd54a0338 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:11:39 -0400 Subject: [PATCH 084/140] refact: entity tags --- src/Domains/Guild/Leads/Factories/LeadFactory.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Domains/Guild/Leads/Factories/LeadFactory.php b/src/Domains/Guild/Leads/Factories/LeadFactory.php index aefce4e1e..26d09bb75 100644 --- a/src/Domains/Guild/Leads/Factories/LeadFactory.php +++ b/src/Domains/Guild/Leads/Factories/LeadFactory.php @@ -5,6 +5,7 @@ namespace Kanvas\Guild\Leads\Factories; use Illuminate\Database\Eloquent\Factories\Factory; +use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Enums\AppEnums; use Kanvas\Guild\Customers\Models\People; @@ -17,6 +18,7 @@ class LeadFactory extends Factory public function definition() { $company = Companies::factory()->create(); + $app = app(Apps::class); return [ 'firstname' => fake()->firstName, 'lastname' => fake()->lastName, @@ -24,7 +26,7 @@ public function definition() 'companies_id' => $company->getId(), 'companies_branches_id' => AppEnums::GLOBAL_COMPANY_ID->getValue(), 'users_id' => 1, - 'people_id' => People::factory()->create()->getId(), + 'people_id' => People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create()->getId(), 'leads_receivers_id' => 0, 'leads_owner_id' => 1, ]; From d296bfc786cc45f4a276b295eccef8107824e679 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:19:00 -0400 Subject: [PATCH 085/140] Refact: migration --- ...2024_06_12_041705_refact_tags_entities.php | 30 +++++++++++++++++++ .../Guild/Leads/Factories/LeadFactory.php | 1 + .../Social/Tags/Traits/HasTagsTrait.php | 1 - 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 database/migrations/Social/2024_06_12_041705_refact_tags_entities.php diff --git a/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php new file mode 100644 index 000000000..a963475b5 --- /dev/null +++ b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php @@ -0,0 +1,30 @@ +dropColumn('entity_namespace'); + }); + } + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tags_entities', function (Blueprint $table) { + $table->string('entity_namespace', 255)->nullable(); + }); + } +}; diff --git a/src/Domains/Guild/Leads/Factories/LeadFactory.php b/src/Domains/Guild/Leads/Factories/LeadFactory.php index 26d09bb75..66da63714 100644 --- a/src/Domains/Guild/Leads/Factories/LeadFactory.php +++ b/src/Domains/Guild/Leads/Factories/LeadFactory.php @@ -19,6 +19,7 @@ public function definition() { $company = Companies::factory()->create(); $app = app(Apps::class); + return [ 'firstname' => fake()->firstName, 'lastname' => fake()->lastName, diff --git a/src/Domains/Social/Tags/Traits/HasTagsTrait.php b/src/Domains/Social/Tags/Traits/HasTagsTrait.php index ebfdc6a02..860bc4d81 100644 --- a/src/Domains/Social/Tags/Traits/HasTagsTrait.php +++ b/src/Domains/Social/Tags/Traits/HasTagsTrait.php @@ -51,7 +51,6 @@ public function addTag( ))->execute(); $this->tags()->attach($this->getId(), [ - 'entity_namespace' => self::class, 'companies_id' => $company->getId(), 'apps_id' => $app->getId(), 'tags_id' => $tag->getId(), From c5cb3048dbbdc086056ac86873d80de504ce1d50 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:20:11 -0400 Subject: [PATCH 086/140] refact: add trait --- src/Domains/Guild/Leads/Models/Lead.php | 2 ++ src/Domains/Guild/Organizations/Models/Organization.php | 2 ++ src/Domains/Social/Messages/Models/Message.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/Domains/Guild/Leads/Models/Lead.php b/src/Domains/Guild/Leads/Models/Lead.php index 130765dce..7da7fa494 100644 --- a/src/Domains/Guild/Leads/Models/Lead.php +++ b/src/Domains/Guild/Leads/Models/Lead.php @@ -23,6 +23,7 @@ use Kanvas\Guild\Pipelines\Models\PipelineStage; use Kanvas\Social\Channels\Models\Channel; use Kanvas\Social\Follows\Traits\FollowersTrait; +use Kanvas\Social\Tags\Traits\HasTagsTrait; use Kanvas\SystemModules\Models\SystemModules; use Kanvas\Users\Models\Users; use Kanvas\Workflow\Traits\CanUseWorkflow; @@ -61,6 +62,7 @@ class Lead extends BaseModel { use UuidTrait; use Searchable; + use HasTagsTrait; use FollowersTrait; use CanUseWorkflow; diff --git a/src/Domains/Guild/Organizations/Models/Organization.php b/src/Domains/Guild/Organizations/Models/Organization.php index e8eec2f63..5ca622024 100644 --- a/src/Domains/Guild/Organizations/Models/Organization.php +++ b/src/Domains/Guild/Organizations/Models/Organization.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Models\BaseModel; +use Kanvas\Social\Tags\Traits\HasTagsTrait; /** * Class Organization. @@ -23,6 +24,7 @@ class Organization extends BaseModel { use UuidTrait; + use HasTagsTrait; protected $table = 'organizations'; protected $guarded = []; diff --git a/src/Domains/Social/Messages/Models/Message.php b/src/Domains/Social/Messages/Models/Message.php index c875ec3e3..5c309ab0f 100644 --- a/src/Domains/Social/Messages/Models/Message.php +++ b/src/Domains/Social/Messages/Models/Message.php @@ -23,6 +23,7 @@ use Laravel\Scout\Searchable; use Baka\Traits\SoftDeletesTrait; use Dyrynda\Database\Support\CascadeSoftDeletes; +use Kanvas\Social\Tags\Traits\HasTagsTrait; /** * Class Message @@ -47,6 +48,7 @@ class Message extends BaseModel use UuidTrait; use Searchable; use HasFactory; + use HasTagsTrait; use CascadeSoftDeletes; use SoftDeletesTrait; From 6666bf18fced0a506c627524ae37b30ffdd6c7f3 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 00:27:35 -0400 Subject: [PATCH 087/140] fix: test --- app/GraphQL/Social/Mutations/Tags/TagsManagement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index cfbd89538..20e73e0f3 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -89,7 +89,7 @@ public function attachTagToEntity(mixed $root, array $request): bool ); $tag->entities()->attach($entity->getId(), [ - 'entity_namespace' => $systemModule->model_name, + //'entity_namespace' => $systemModule->model_name, 'apps_id' => $tag->apps_id, 'companies_id' => $user->getCurrentCompany()->getId(), 'users_id' => $user->getId(), From 6c8ffe4b4fd04488eb64c095d118e7e379973257 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 06:35:10 -0400 Subject: [PATCH 088/140] refact: sync tags --- src/Domains/Guild/Customers/Actions/CreatePeopleAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index 6e0dff3b9..91ca58a2c 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -58,7 +58,7 @@ public function execute(): People $people->saveCustomFields(); if (count($this->peopleData->tags)) { - $people->addTags(array_column($this->peopleData->tags, 'name')); + $people->syncTags(array_column($this->peopleData->tags, 'name')); } if ($this->peopleData->contacts->count()) { From b1bcf826acdb1082634eede68d9a143fccdec982 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 08:31:06 -0400 Subject: [PATCH 089/140] refact: add relationship --- graphql/schemas/Guild/people.graphql | 2 ++ src/Domains/Social/Messages/Models/Message.php | 6 +++--- src/Domains/Social/Tags/Models/Tag.php | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 283d7a6c1..6877e96e9 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -76,6 +76,8 @@ extend type Query @guard { @whereHasConditions(relation: "emails", columns: ["id", "value"]) hasPhones: _ @whereHasConditions(relation: "phones", columns: ["id", "value"]) + hasTags: _ + @whereHasConditions(relation: "tags", columns: ["name"]) hasCustomFields: _ @whereHasConditions( relation: "customFields" diff --git a/src/Domains/Social/Messages/Models/Message.php b/src/Domains/Social/Messages/Models/Message.php index 5c309ab0f..5e86890a8 100644 --- a/src/Domains/Social/Messages/Models/Message.php +++ b/src/Domains/Social/Messages/Models/Message.php @@ -5,7 +5,9 @@ namespace Kanvas\Social\Messages\Models; use Baka\Casts\Json; +use Baka\Traits\SoftDeletesTrait; use Baka\Traits\UuidTrait; +use Dyrynda\Database\Support\CascadeSoftDeletes; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -18,12 +20,10 @@ use Kanvas\Social\MessagesComments\Models\MessageComment; use Kanvas\Social\MessagesTypes\Models\MessageType; use Kanvas\Social\Models\BaseModel; +use Kanvas\Social\Tags\Traits\HasTagsTrait; use Kanvas\Social\Topics\Models\Topic; use Kanvas\Users\Models\Users; use Laravel\Scout\Searchable; -use Baka\Traits\SoftDeletesTrait; -use Dyrynda\Database\Support\CascadeSoftDeletes; -use Kanvas\Social\Tags\Traits\HasTagsTrait; /** * Class Message diff --git a/src/Domains/Social/Tags/Models/Tag.php b/src/Domains/Social/Tags/Models/Tag.php index 03cc52ab3..4a4e3b9d9 100644 --- a/src/Domains/Social/Tags/Models/Tag.php +++ b/src/Domains/Social/Tags/Models/Tag.php @@ -5,6 +5,7 @@ namespace Kanvas\Social\Tags\Models; use Baka\Traits\SlugTrait; +use Illuminate\Support\Facades\DB; use Kanvas\Social\Models\BaseModel; /** @@ -22,6 +23,7 @@ class Tag extends BaseModel use SlugTrait; protected $guarded = []; + protected $table = 'tags'; public function taggables() { @@ -34,4 +36,10 @@ public function entities() ->using(TagEntity::class) ->withPivot('entity_namespace', 'companies_id', 'apps_id', 'users_id', 'is_deleted', 'created_at', 'updated_at'); } + + public function getTable() + { + $databaseName = DB::connection($this->connection)->getDatabaseName(); + return $databaseName . '.' . $this->table; + } } From 87d2f31ef5cd95f5baeafc7645e59fc01f6029d7 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 08:45:16 -0400 Subject: [PATCH 090/140] refact: fix --- src/Domains/Social/Tags/Models/Tag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Social/Tags/Models/Tag.php b/src/Domains/Social/Tags/Models/Tag.php index 4a4e3b9d9..50baab46c 100644 --- a/src/Domains/Social/Tags/Models/Tag.php +++ b/src/Domains/Social/Tags/Models/Tag.php @@ -40,6 +40,6 @@ public function entities() public function getTable() { $databaseName = DB::connection($this->connection)->getDatabaseName(); - return $databaseName . '.' . $this->table; + return $databaseName . '.tags'; } } From 61fda61d78eaf461b450890802b50fc83b7dbb3c Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 10:30:54 -0400 Subject: [PATCH 091/140] feat: change status --- .../Engagements/TaskEngagementMutation.php | 35 +++++++++++++++++++ graphql/schemas/ActionEngine/task.graphql | 7 ++++ 2 files changed, 42 insertions(+) create mode 100644 app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php diff --git a/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php b/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php new file mode 100644 index 000000000..b3e75a845 --- /dev/null +++ b/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php @@ -0,0 +1,35 @@ +user(); + $company = $user->getCurrentCompany(); + $app = app(Apps::class); + $status = $request['status']; + + $taskListItem = TaskListItem::getById($id); + + if ($taskListItem->companyAction->company_id != $company->getId()) { + throw new ValidationException('You are not allowed to change the status of this task'); + } + + if ($taskListItem->companyAction->apps_id != $app->getId()) { + throw new ValidationException('You are not allowed to change the status of this task'); + } + + $taskListItem->status = $status; + + return $taskListItem->saveOrFail(); + } +} diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index eec8fe747..8f3a63122 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -35,3 +35,10 @@ extend type Query @guard { defaultCount: 25 ) } + +extend type Mutation @guard { + changeTaskEngagementItemStatus(id: ID!, status: String!): Boolean! + @field( + resolver: "App\\GraphQL\\ActionEngine\\Mutations\\Engagements\\TaskEngagementMutation@changeEngagementTaskItemStatus" + ) +} \ No newline at end of file From 682760e9716ddd8acd5ae54996ed61cb6f21f346 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 11:11:29 -0400 Subject: [PATCH 092/140] refact: remove apps and companies from morph table --- .../Social/Mutations/Tags/TagsManagement.php | 4 ++-- .../2024_06_12_041705_refact_tags_entities.php | 14 ++++++++------ graphql/schemas/Guild/people.graphql | 2 +- src/Domains/Social/Tags/Traits/HasTagsTrait.php | 12 ++---------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php index 20e73e0f3..0fda51242 100644 --- a/app/GraphQL/Social/Mutations/Tags/TagsManagement.php +++ b/app/GraphQL/Social/Mutations/Tags/TagsManagement.php @@ -90,8 +90,8 @@ public function attachTagToEntity(mixed $root, array $request): bool $tag->entities()->attach($entity->getId(), [ //'entity_namespace' => $systemModule->model_name, - 'apps_id' => $tag->apps_id, - 'companies_id' => $user->getCurrentCompany()->getId(), + //'apps_id' => $tag->apps_id, + //'companies_id' => $user->getCurrentCompany()->getId(), 'users_id' => $user->getId(), 'taggable_type' => $systemModule->model_name, ]); diff --git a/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php index a963475b5..3b7308bb9 100644 --- a/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php +++ b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php @@ -10,12 +10,12 @@ */ public function up(): void { - //remove field entity_namespace from tags_entities - if (Schema::hasColumn('tags_entities', 'entity_namespace')) { - Schema::table('tags_entities', function (Blueprint $table) { - $table->dropColumn('entity_namespace'); - }); - } + Schema::table('tags_entities', function (Blueprint $table) { + $table->dropColumn('entity_namespace'); + $table->dropColumn('apps_id'); + $table->dropColumn('companies_id'); + }); + } /** @@ -25,6 +25,8 @@ public function down(): void { Schema::table('tags_entities', function (Blueprint $table) { $table->string('entity_namespace', 255)->nullable(); + $table->integer('apps_id')->nullable(); + $table->integer('companies_id')->nullable(); }); } }; diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 6877e96e9..a5e7b637b 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -88,7 +88,7 @@ extend type Query @guard { ): [People!]! @paginate( model: "Kanvas\\Guild\\Customers\\Models\\People" - scopes: ["fromApp", "fromCompany", "notDeleted"] + scopes: [ "notDeleted"] defaultCount: 25 ) peopleRelationships( diff --git a/src/Domains/Social/Tags/Traits/HasTagsTrait.php b/src/Domains/Social/Tags/Traits/HasTagsTrait.php index 860bc4d81..27dc59253 100644 --- a/src/Domains/Social/Tags/Traits/HasTagsTrait.php +++ b/src/Domains/Social/Tags/Traits/HasTagsTrait.php @@ -15,18 +15,12 @@ trait HasTagsTrait { - public function tags(bool $userCompany = true): MorphToMany + public function tags(): MorphToMany { $dbConnection = config('database.connections.social.database'); $query = $this->morphToMany(ModelsTag::class, 'taggable', $dbConnection . '.tags_entities', 'entity_id', 'tags_id') - ->using(TagEntity::class) - ->wherePivot('apps_id', $this->apps_id); - - - if ($userCompany) { - $query->wherePivot('companies_id', $this->companies_id); - } + ->using(TagEntity::class); return $query; } @@ -51,8 +45,6 @@ public function addTag( ))->execute(); $this->tags()->attach($this->getId(), [ - 'companies_id' => $company->getId(), - 'apps_id' => $app->getId(), 'tags_id' => $tag->getId(), 'users_id' => $user->getId(), 'is_deleted' => 0, From c4b705a3d7c8437552e763b56273f70276885bda Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 11:13:25 -0400 Subject: [PATCH 093/140] refact: add relationship --- .../migrations/Social/2024_06_12_041705_refact_tags_entities.php | 1 - 1 file changed, 1 deletion(-) diff --git a/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php index 3b7308bb9..00313e3ee 100644 --- a/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php +++ b/database/migrations/Social/2024_06_12_041705_refact_tags_entities.php @@ -15,7 +15,6 @@ public function up(): void $table->dropColumn('apps_id'); $table->dropColumn('companies_id'); }); - } /** From 9e5b1aeca436e2ac94d5f06270778b3e29797e30 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 11:15:46 -0400 Subject: [PATCH 094/140] refact: return scope --- graphql/schemas/Guild/people.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index a5e7b637b..6877e96e9 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -88,7 +88,7 @@ extend type Query @guard { ): [People!]! @paginate( model: "Kanvas\\Guild\\Customers\\Models\\People" - scopes: [ "notDeleted"] + scopes: ["fromApp", "fromCompany", "notDeleted"] defaultCount: 25 ) peopleRelationships( From c90a220fac520cc65131229966059a68710204fa Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 15:31:51 -0400 Subject: [PATCH 095/140] refact: fix message --- graphql/schemas/Social/message.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphql/schemas/Social/message.graphql b/graphql/schemas/Social/message.graphql index 924cbb990..79da1a4eb 100644 --- a/graphql/schemas/Social/message.graphql +++ b/graphql/schemas/Social/message.graphql @@ -15,7 +15,7 @@ type Message { parent: Message user: User! messageType: MessageType! - appModuleMessage: AppModuleMessage! + appModuleMessage: AppModuleMessage myInteraction: myInteraction @method(name: "getMyInteraction") comments: [MessageComments!]! custom_fields: [CustomField!]! From 916df47eade64c7d9528aac6cff65e5f74524c9c Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 15:44:50 -0400 Subject: [PATCH 096/140] updated development dockerfile --- development.Dockerfile | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/development.Dockerfile b/development.Dockerfile index 1b7868376..0be9a680a 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -1,9 +1,4 @@ -FROM --platform=linux/arm64 unit:php8.3 - -# # Define a build argument for the target architecture -# ARG TARGETARCH -# # Set an environment variable to use the architecture in commands -# ENV ARCH=$TARGETARCH +FROM unit:php8.3 COPY ./docker/unit.json /docker-entrypoint.d/ @@ -31,29 +26,20 @@ RUN apt-get update && apt-get install -y \ nginx \ vim -# Set working directory -WORKDIR /app - -# RUN groupadd -g 1000 unit -# RUN useradd -u 1000 -ms /bin/bash -g unit unit - -# Copy code to /var/www -COPY . /app -# COPY chown -R unit:unit /var/www/html/ -# Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - +COPY . /var/www/html/ +# COPY chown -R unit:unit /var/www/html/ # add root to www group # RUN chmod -R ug+w var/www/html/storage - -RUN cp docker/docker-php-ext-opcache-prod.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini -RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini # RUN cp docker/php-fpm.conf /usr/local/etc/php-fpm.d/zzz-php-fpm-production.conf WORKDIR /var/www/html/ +RUN cp docker/docker-php-ext-opcache-prod.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini +RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini + RUN composer install --optimize-autoloader EXPOSE 8080 \ No newline at end of file From 4714dca01c999b4b1744b6cab022f09aa228df94 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:02:37 -0400 Subject: [PATCH 097/140] remove command for php --- docker-compose.dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 3d54923f0..ead8bb377 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -6,7 +6,6 @@ services: dockerfile: development.Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' - command: ["sh", "-c", "php artisan lighthouse:cache && php artisan config:cache"] environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From 7023663e6570f8b5b397caf990e4b12a3917455a Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 12 Jun 2024 16:14:23 -0400 Subject: [PATCH 098/140] Searchable warehouses --- graphql/schemas/Inventory/warehouse.graphql | 1 + .../Warehouses/Models/Warehouses.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/graphql/schemas/Inventory/warehouse.graphql b/graphql/schemas/Inventory/warehouse.graphql index 100c9af2c..e07e7fb39 100644 --- a/graphql/schemas/Inventory/warehouse.graphql +++ b/graphql/schemas/Inventory/warehouse.graphql @@ -62,6 +62,7 @@ extend type Mutation @guard { } extend type Query @guard { warehouses( + search: String @search where: _ @whereConditions( columns: [ diff --git a/src/Domains/Inventory/Warehouses/Models/Warehouses.php b/src/Domains/Inventory/Warehouses/Models/Warehouses.php index 1133330ce..e50c9ab36 100644 --- a/src/Domains/Inventory/Warehouses/Models/Warehouses.php +++ b/src/Domains/Inventory/Warehouses/Models/Warehouses.php @@ -13,6 +13,9 @@ use Kanvas\Inventory\Regions\Models\Regions; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; +use Laravel\Scout\EngineManager; +use Laravel\Scout\Engines\Engine; +use Laravel\Scout\Searchable; /** * Class Warehouses. @@ -35,6 +38,9 @@ class Warehouses extends BaseModel { use UuidTrait; use DefaultTrait; + use Searchable { + search as public traitSearch; + } protected $table = 'warehouses'; @@ -204,4 +210,24 @@ public function setTotalProducts(): int return 0; } + + /** + * Get the engine used to index the model. + */ + public function searchableUsing(): Engine + { + return app(EngineManager::class)->engine('database'); + } + + public function toSearchableArray(): array + { + return [ + 'id' => $this->id, + 'name' => $this->name, + 'uuid' => $this->uuid, + 'regions_id' => $this->regions_id, + 'location' => $this->location, + 'is_published' => $this->is_published, + ]; + } } From d83041baa3c2c75c985a62034d11117ffd224dcd Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 16:16:12 -0400 Subject: [PATCH 099/140] refact: fix --- graphql/schemas/Social/message.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql/schemas/Social/message.graphql b/graphql/schemas/Social/message.graphql index 79da1a4eb..661f48c6e 100644 --- a/graphql/schemas/Social/message.graphql +++ b/graphql/schemas/Social/message.graphql @@ -113,6 +113,7 @@ extend type Query @guard { "parent_unique_id" "companies_id" "uuid" + "users_id" "message_types_id" "message" "reactions_count" From e4ddb8ae1ddc0ee940e001dba6b578b09eff19db Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:23:00 -0400 Subject: [PATCH 100/140] give permissions for logs --- development.Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/development.Dockerfile b/development.Dockerfile index 82bc1bb34..cc7c89b4b 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -41,6 +41,10 @@ WORKDIR /var/www/html/ RUN cp docker/docker-php-ext-opcache-prod.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini RUN cp docker/php.ini /usr/local/etc/php/conf.d/zx-app-config.ini +RUN chmod -R 755 /var/www/html/ +RUN chmod -R 777 /var/www/html/storage/ +RUN chmod -R 777 /var/www/html/storage/logs/ + RUN composer install --optimize-autoloader EXPOSE 8080 \ No newline at end of file From d8d296df277049df7117a0012e0945fa32b26c0f Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:23:15 -0400 Subject: [PATCH 101/140] add command execution after deploy of code in ec2 --- .github/workflows/ec2-deploy.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 5bdeeb758..38eb9e39a 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -24,4 +24,16 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} source: . - target: ${{secrets.AWS_EC2_TARGET_DIR}} \ No newline at end of file + target: ${{secrets.AWS_EC2_TARGET_DIR}} + laravel-command: + name: Build + runs-on: ubuntu-latest + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.AWS_EC2_HOST }} + username: ${{ secrets.AWS_EC2_USERNAME }} + key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} + script: | + docker exec -it phpkanvas-ecosystem php artisan lighthouse:cache && php artisan config:cache From f6ae8f6bd401c45971d48be1053a9206a138e325 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:26:16 -0400 Subject: [PATCH 102/140] add env in step --- .github/workflows/ec2-deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 38eb9e39a..67a6d32b7 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -26,8 +26,9 @@ jobs: source: . target: ${{secrets.AWS_EC2_TARGET_DIR}} laravel-command: - name: Build + name: Clear cache Laravel runs-on: ubuntu-latest + environment: ${{ github.ref_name }} steps: - name: executing remote ssh commands using password uses: appleboy/ssh-action@v1.0.3 From c6a05877af7c1eaf417fd559fd1cdbc2ed0c5dd8 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:40:49 -0400 Subject: [PATCH 103/140] separate commands --- .github/workflows/ec2-deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 67a6d32b7..8d0545b75 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,4 +37,5 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - docker exec -it phpkanvas-ecosystem php artisan lighthouse:cache && php artisan config:cache + docker exec -it phpkanvas-ecosystem php artisan lighthouse:cache + docker exec -it phpkanvas-ecosystem php artisan config:cache From 315dd368bb23ba222f848400d5e082c8144eb51c Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:43:01 -0400 Subject: [PATCH 104/140] remove t flag --- .github/workflows/ec2-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 8d0545b75..292cc3093 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,5 +37,5 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - docker exec -it phpkanvas-ecosystem php artisan lighthouse:cache - docker exec -it phpkanvas-ecosystem php artisan config:cache + docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache + docker exec -i phpkanvas-ecosystem php artisan config:cache From 63e709bf1a08d3dbec2f284956514dfc89dea987 Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 12 Jun 2024 16:48:04 -0400 Subject: [PATCH 105/140] Add searchable directive --- graphql/schemas/Inventory/attributes.graphql | 1 + graphql/schemas/Inventory/category.graphql | 1 + graphql/schemas/Inventory/channel.graphql | 1 + graphql/schemas/Inventory/productType.graphql | 1 + graphql/schemas/Inventory/status.graphql | 1 + 5 files changed, 5 insertions(+) diff --git a/graphql/schemas/Inventory/attributes.graphql b/graphql/schemas/Inventory/attributes.graphql index 8a2f62264..83dc2a3bd 100644 --- a/graphql/schemas/Inventory/attributes.graphql +++ b/graphql/schemas/Inventory/attributes.graphql @@ -67,6 +67,7 @@ extend type Mutation @guard { } extend type Query @guard { attributes( + search: String @search where: _ @whereConditions( columns: [ diff --git a/graphql/schemas/Inventory/category.graphql b/graphql/schemas/Inventory/category.graphql index 62ab4bc25..006f94b0a 100644 --- a/graphql/schemas/Inventory/category.graphql +++ b/graphql/schemas/Inventory/category.graphql @@ -54,6 +54,7 @@ extend type Mutation @guard { extend type Query @guard { categories( + search: String @search where: _ @whereConditions( columns: [ diff --git a/graphql/schemas/Inventory/channel.graphql b/graphql/schemas/Inventory/channel.graphql index a99096a5a..4e0f33320 100644 --- a/graphql/schemas/Inventory/channel.graphql +++ b/graphql/schemas/Inventory/channel.graphql @@ -48,6 +48,7 @@ extend type Mutation @guard { } extend type Query @guard { channels( + search: String @search where: _ @whereConditions( columns: [ diff --git a/graphql/schemas/Inventory/productType.graphql b/graphql/schemas/Inventory/productType.graphql index bda707e31..2a221a0fd 100644 --- a/graphql/schemas/Inventory/productType.graphql +++ b/graphql/schemas/Inventory/productType.graphql @@ -63,6 +63,7 @@ extend type Mutation @guard { } extend type Query { productTypes( + search: String @search where: _ @whereConditions( columns: [ diff --git a/graphql/schemas/Inventory/status.graphql b/graphql/schemas/Inventory/status.graphql index 2a8bb12f6..c48a6d963 100644 --- a/graphql/schemas/Inventory/status.graphql +++ b/graphql/schemas/Inventory/status.graphql @@ -37,6 +37,7 @@ extend type Mutation @guard { extend type Query @guard { status( + search: String @search where: _ @whereConditions( columns: [ From d8f4614a34cc2c8db0a6a4c9566e0fc08e690ca2 Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 12 Jun 2024 16:48:21 -0400 Subject: [PATCH 106/140] Create database searchable engine trait --- .../Traits/DatabaseSearchableTrait.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Domains/Inventory/Traits/DatabaseSearchableTrait.php diff --git a/src/Domains/Inventory/Traits/DatabaseSearchableTrait.php b/src/Domains/Inventory/Traits/DatabaseSearchableTrait.php new file mode 100644 index 000000000..b0b89aeeb --- /dev/null +++ b/src/Domains/Inventory/Traits/DatabaseSearchableTrait.php @@ -0,0 +1,32 @@ +engine('database'); + } + + public function toSearchableArray(): array + { + return [ + 'id' => $this->id, + 'name' => $this->name, + ]; + } +} From 5880d3410ea5b0c278cdf00894ecaf48eefc270b Mon Sep 17 00:00:00 2001 From: arfenis Date: Wed, 12 Jun 2024 16:48:49 -0400 Subject: [PATCH 107/140] Add searchable trait to entities --- .../Attributes/Models/Attributes.php | 2 ++ .../Categories/Models/Categories.php | 2 ++ .../Inventory/Channels/Models/Channels.php | 2 ++ .../ProductsTypes/Models/ProductsTypes.php | 2 ++ .../Inventory/Status/Models/Status.php | 3 +- .../Warehouses/Models/Warehouses.php | 28 ++----------------- 6 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/Domains/Inventory/Attributes/Models/Attributes.php b/src/Domains/Inventory/Attributes/Models/Attributes.php index afa033285..b6885efb5 100644 --- a/src/Domains/Inventory/Attributes/Models/Attributes.php +++ b/src/Domains/Inventory/Attributes/Models/Attributes.php @@ -12,6 +12,7 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Variants\Models\VariantsAttributes; /** @@ -27,6 +28,7 @@ class Attributes extends BaseModel { use UuidTrait; use CascadeSoftDeletes; + use DatabaseSearchableTrait; public $table = 'attributes'; public $guarded = []; diff --git a/src/Domains/Inventory/Categories/Models/Categories.php b/src/Domains/Inventory/Categories/Models/Categories.php index cb717b6b5..2dbeb1ff8 100644 --- a/src/Domains/Inventory/Categories/Models/Categories.php +++ b/src/Domains/Inventory/Categories/Models/Categories.php @@ -12,6 +12,7 @@ use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Products\Models\ProductsCategories; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\ScopesTrait; class Categories extends BaseModel @@ -19,6 +20,7 @@ class Categories extends BaseModel use UuidTrait; use SlugTrait; use ScopesTrait; + use DatabaseSearchableTrait; protected $table = 'categories'; protected $guarded = []; diff --git a/src/Domains/Inventory/Channels/Models/Channels.php b/src/Domains/Inventory/Channels/Models/Channels.php index 3dbcf4a57..4539dea78 100644 --- a/src/Domains/Inventory/Channels/Models/Channels.php +++ b/src/Domains/Inventory/Channels/Models/Channels.php @@ -12,6 +12,7 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsChannels; @@ -37,6 +38,7 @@ class Channels extends BaseModel { use UuidTrait; use SlugTrait; + use DatabaseSearchableTrait; use DefaultTrait; protected $table = 'channels'; diff --git a/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php b/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php index 75ef48425..3ff2cc504 100644 --- a/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php +++ b/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php @@ -16,6 +16,7 @@ use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Products\Factories\ProductTypeFactory; use Kanvas\Inventory\Products\Models\Products; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\ScopesTrait; /** @@ -36,6 +37,7 @@ class ProductsTypes extends BaseModel use UuidTrait; use SlugTrait; use ScopesTrait; + use DatabaseSearchableTrait; use CascadeSoftDeletes; protected $table = 'products_types'; diff --git a/src/Domains/Inventory/Status/Models/Status.php b/src/Domains/Inventory/Status/Models/Status.php index 79501d929..a16555a3c 100644 --- a/src/Domains/Inventory/Status/Models/Status.php +++ b/src/Domains/Inventory/Status/Models/Status.php @@ -7,6 +7,7 @@ use Baka\Traits\SlugTrait; use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\Inventory\Models\BaseModel; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; @@ -24,7 +25,7 @@ class Status extends BaseModel { use SlugTrait; - //use Searchable; + use DatabaseSearchableTrait; use DefaultTrait; protected $table = 'status'; diff --git a/src/Domains/Inventory/Warehouses/Models/Warehouses.php b/src/Domains/Inventory/Warehouses/Models/Warehouses.php index e50c9ab36..9e94b79e9 100644 --- a/src/Domains/Inventory/Warehouses/Models/Warehouses.php +++ b/src/Domains/Inventory/Warehouses/Models/Warehouses.php @@ -11,11 +11,9 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Regions\Models\Regions; +use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; -use Laravel\Scout\EngineManager; -use Laravel\Scout\Engines\Engine; -use Laravel\Scout\Searchable; /** * Class Warehouses. @@ -38,9 +36,7 @@ class Warehouses extends BaseModel { use UuidTrait; use DefaultTrait; - use Searchable { - search as public traitSearch; - } + use DatabaseSearchableTrait; protected $table = 'warehouses'; @@ -210,24 +206,4 @@ public function setTotalProducts(): int return 0; } - - /** - * Get the engine used to index the model. - */ - public function searchableUsing(): Engine - { - return app(EngineManager::class)->engine('database'); - } - - public function toSearchableArray(): array - { - return [ - 'id' => $this->id, - 'name' => $this->name, - 'uuid' => $this->uuid, - 'regions_id' => $this->regions_id, - 'location' => $this->location, - 'is_published' => $this->is_published, - ]; - } } From 87651060b01abac012b903a6c30b086c600001c6 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 16:59:16 -0400 Subject: [PATCH 108/140] remove max jobs --- docker-compose.dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index ead8bb377..5b755b2da 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -24,7 +24,7 @@ services: dockerfile: development.Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' - command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --tries=3 --timeout=1750 --max-jobs=1000"] + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --tries=3 --timeout=1750"] environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 @@ -43,7 +43,7 @@ services: dockerfile: development.Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' - command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue kanvas-social --tries=3 --timeout=1750 --max-jobs=1000"] + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue kanvas-social --tries=3 --timeout=1750"] environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 @@ -62,7 +62,7 @@ services: dockerfile: development.Dockerfile extra_hosts: - 'host.docker.internal:host-gateway' - command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue notifications --tries=3 --timeout=1750 --max-jobs=1000"] + command: ["sh", "-c", "php artisan config:cache && php artisan queue:work --queue notifications --tries=3 --timeout=1750"] environment: WWWUSER: '${WWWUSER}' LARAVEL_SAIL: 1 From d513157d59406ccd1150142092f20dcb9872e037 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:11:49 -0400 Subject: [PATCH 109/140] use shell command for clearcache --- .github/workflows/ec2-deploy.yaml | 5 +++-- clear_cache.sh | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 clear_cache.sh diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 292cc3093..dd66621a1 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,5 +37,6 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache - docker exec -i phpkanvas-ecosystem php artisan config:cache + cd ${{secrets.AWS_EC2_TARGET_DIR}} + chmod +x clear_cache.sh + ./clear_cache.sh diff --git a/clear_cache.sh b/clear_cache.sh new file mode 100644 index 000000000..d687758f1 --- /dev/null +++ b/clear_cache.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache +docker exec -i phpkanvas-ecosystem php artisan config:cache \ No newline at end of file From 25f9ef37ec5ef819d61859651be28d898fc6eec2 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:13:23 -0400 Subject: [PATCH 110/140] asdaedaeda --- .github/workflows/ec2-deploy.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index dd66621a1..5b37160b0 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,6 +37,5 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - cd ${{secrets.AWS_EC2_TARGET_DIR}} - chmod +x clear_cache.sh + chmod +x ${{secrets.AWS_EC2_TARGET_DIR}}clear_cache.sh ./clear_cache.sh From 2ce8c505eea0c2c5eddca4b60e0ef58562c3fad3 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:18:26 -0400 Subject: [PATCH 111/140] add laravel scheduler --- docker-compose.dev.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 5b755b2da..6d37afdbb 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -74,6 +74,25 @@ services: - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini networks: - sail + laravel-scheduler: + container_name: laravel-scheduler + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + command: ["sh", "-c", "php artisan config:cache && php artisan schedule:work"] + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + volumes: + - '.:/var/www/html' + - ./docker/docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + - ./docker/php.ini:/usr/local/etc/php/conf.d/xz-custom.ini + networks: + - sail nginx: image: nginx:latest container_name: nginx${APP_CONTAINER_NAME} From 67cffdc106ae2d3d09ea9ade8aa459f246889355 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:18:35 -0400 Subject: [PATCH 112/140] add path to ssh file --- .github/workflows/ec2-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 5b37160b0..0d9ecb88d 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -38,4 +38,4 @@ jobs: key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | chmod +x ${{secrets.AWS_EC2_TARGET_DIR}}clear_cache.sh - ./clear_cache.sh + ./${{secrets.AWS_EC2_TARGET_DIR}}clear_cache.sh From 9061b7efef4633314c7eb52cc4b0e1a5e08dfb09 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:19:42 -0400 Subject: [PATCH 113/140] asdasda --- .github/workflows/ec2-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 0d9ecb88d..9819f4f59 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,5 +37,5 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - chmod +x ${{secrets.AWS_EC2_TARGET_DIR}}clear_cache.sh - ./${{secrets.AWS_EC2_TARGET_DIR}}clear_cache.sh + chmod +x ${{secrets.AWS_EC2_TARGET_DIR}}/clear_cache.sh + ./${{secrets.AWS_EC2_TARGET_DIR}}/clear_cache.sh From e05f8bf5bd3f00eae718f8b040452183620b5076 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:23:42 -0400 Subject: [PATCH 114/140] rollback changes --- .github/workflows/ec2-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 9819f4f59..292cc3093 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,5 +37,5 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | - chmod +x ${{secrets.AWS_EC2_TARGET_DIR}}/clear_cache.sh - ./${{secrets.AWS_EC2_TARGET_DIR}}/clear_cache.sh + docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache + docker exec -i phpkanvas-ecosystem php artisan config:cache From 8efa7a9ecf300f2d8c71cffe555af60974a54cba Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:30:06 -0400 Subject: [PATCH 115/140] add docker compose up after deploy --- .github/workflows/ec2-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 292cc3093..fa5ee67a0 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,5 +37,6 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | + docker compose -f docker-compose.dev.yml up -d docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache docker exec -i phpkanvas-ecosystem php artisan config:cache From 858be319b0009b5cf8fdf991d42395e413c8b3d7 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:31:43 -0400 Subject: [PATCH 116/140] cd to target dir --- .github/workflows/ec2-deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index fa5ee67a0..e300f1fba 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -37,6 +37,7 @@ jobs: username: ${{ secrets.AWS_EC2_USERNAME }} key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | + cd ${{secrets.AWS_EC2_TARGET_DIR}} docker compose -f docker-compose.dev.yml up -d docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache docker exec -i phpkanvas-ecosystem php artisan config:cache From 5668909bcaeeea040f300d6431e3f4e321de622f Mon Sep 17 00:00:00 2001 From: Rafael White Date: Wed, 12 Jun 2024 17:35:35 -0400 Subject: [PATCH 117/140] add depends on docker command job --- .github/workflows/ec2-deploy.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index e300f1fba..8a7880776 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -25,9 +25,10 @@ jobs: key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} source: . target: ${{secrets.AWS_EC2_TARGET_DIR}} - laravel-command: - name: Clear cache Laravel + docker-command: + name: Docker commands runs-on: ubuntu-latest + needs: deploy-to-ec2 environment: ${{ github.ref_name }} steps: - name: executing remote ssh commands using password From 8d96789d104b5101867d68dc0e275a97f3fa05d2 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 12 Jun 2024 23:16:44 -0400 Subject: [PATCH 118/140] fix: variant update --- graphql/schemas/Inventory/variant.graphql | 2 ++ .../Variants/Actions/CreateVariantsAction.php | 2 +- .../Inventory/Variants/Services/VariantService.php | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index 377a83550..a84d75e45 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -9,6 +9,8 @@ type Variant { html_description: String sku: String ean: String + barcode: String + serial_number: String status: Status files: [Filesystem] @paginate( diff --git a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php index f107dcf03..334f7471d 100644 --- a/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php +++ b/src/Domains/Inventory/Variants/Actions/CreateVariantsAction.php @@ -45,7 +45,6 @@ public function execute(): Variants $search = [ 'products_id' => $this->variantDto->product->getId(), - 'slug' => $this->variantDto->slug ?? Str::slug($this->variantDto->name), 'sku' => $this->variantDto->sku, 'companies_id' => $this->variantDto->product->companies_id, 'apps_id' => $this->variantDto->product->apps_id, @@ -56,6 +55,7 @@ public function execute(): Variants [ 'name' => $this->variantDto->name, 'users_id' => $this->user->getId(), + 'slug' => $this->variantDto->slug ?? Str::slug($this->variantDto->name), 'description' => $this->variantDto->description, 'short_description' => $this->variantDto->short_description, 'html_description' => $this->variantDto->html_description, diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index 95e7034b2..ac81d6ef6 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -15,6 +15,7 @@ use Kanvas\Inventory\Variants\Actions\CreateVariantsAction; use Kanvas\Inventory\Variants\Actions\UpdateToChannelAction; use Kanvas\Inventory\Variants\Actions\UpdateToWarehouseAction; +use Kanvas\Inventory\Variants\Actions\UpdateVariantsAction; use Kanvas\Inventory\Variants\DataTransferObject\VariantChannel as VariantChannelDto; use Kanvas\Inventory\Variants\DataTransferObject\Variants as VariantsDto; use Kanvas\Inventory\Variants\DataTransferObject\VariantsWarehouses; @@ -41,7 +42,14 @@ public static function createVariantsFromArray(Products $product, array $variant ...$variant, ]); - $variantModel = (new CreateVariantsAction($variantDto, $user))->execute(); + $existVariantUpdate = Variants::fromCompany($product->company)->fromApp($product->app)->where('sku', $variantDto->sku)->first(); + + if (! $existVariantUpdate) { + $variantModel = (new CreateVariantsAction($variantDto, $user))->execute(); + } else { + $variantModel = (new UpdateVariantsAction($existVariantUpdate, $variantDto, $user))->execute(); + } + $company = $variantDto->product->company; if (isset($variant['custom_fields']) && ! empty($variant['custom_fields'])) { From 9d8c4c19b630200f14beb6909618dd8f0a2d4bbd Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 13 Jun 2024 00:25:49 -0400 Subject: [PATCH 119/140] refact: update --- graphql/schemas/Inventory/variant.graphql | 4 ++-- src/Domains/Inventory/Variants/Services/VariantService.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index a84d75e45..27473bf59 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -79,13 +79,13 @@ input VariantsInput { input VariantsUpdateInput { products_id: ID - name: String + name: String! description: String short_description: String html_description: String files: [FilesystemInputUrl!] status: StatusReferenceInput - sku: String + sku: String! ean: String barcode: String attributes: [VariantsAttributesInput!] diff --git a/src/Domains/Inventory/Variants/Services/VariantService.php b/src/Domains/Inventory/Variants/Services/VariantService.php index ac81d6ef6..e5f36049c 100644 --- a/src/Domains/Inventory/Variants/Services/VariantService.php +++ b/src/Domains/Inventory/Variants/Services/VariantService.php @@ -42,12 +42,12 @@ public static function createVariantsFromArray(Products $product, array $variant ...$variant, ]); - $existVariantUpdate = Variants::fromCompany($product->company)->fromApp($product->app)->where('sku', $variantDto->sku)->first(); + $existVariantUpdate = Variants::fromCompany($product->company)->fromApp($product->app)->where('sku', $variantDto->sku); - if (! $existVariantUpdate) { + if (! $existVariantUpdate->exists()) { $variantModel = (new CreateVariantsAction($variantDto, $user))->execute(); } else { - $variantModel = (new UpdateVariantsAction($existVariantUpdate, $variantDto, $user))->execute(); + $variantModel = (new UpdateVariantsAction($existVariantUpdate->first(), $variantDto, $user))->execute(); } $company = $variantDto->product->company; From c7eb40a60ceeebc6160d62d19c66c520227450d4 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 11:15:09 -0400 Subject: [PATCH 120/140] move trait to baka --- .../Inventory => Baka}/Traits/DatabaseSearchableTrait.php | 2 +- src/Domains/Inventory/Attributes/Models/Attributes.php | 2 +- src/Domains/Inventory/Categories/Models/Categories.php | 2 +- src/Domains/Inventory/Channels/Models/Channels.php | 2 +- src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php | 2 +- src/Domains/Inventory/Status/Models/Status.php | 2 +- src/Domains/Inventory/Warehouses/Models/Warehouses.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename src/{Domains/Inventory => Baka}/Traits/DatabaseSearchableTrait.php (94%) diff --git a/src/Domains/Inventory/Traits/DatabaseSearchableTrait.php b/src/Baka/Traits/DatabaseSearchableTrait.php similarity index 94% rename from src/Domains/Inventory/Traits/DatabaseSearchableTrait.php rename to src/Baka/Traits/DatabaseSearchableTrait.php index b0b89aeeb..64239a646 100644 --- a/src/Domains/Inventory/Traits/DatabaseSearchableTrait.php +++ b/src/Baka/Traits/DatabaseSearchableTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Kanvas\Inventory\Traits; +namespace Baka\Traits; use Laravel\Scout\EngineManager; use Laravel\Scout\Engines\Engine; diff --git a/src/Domains/Inventory/Attributes/Models/Attributes.php b/src/Domains/Inventory/Attributes/Models/Attributes.php index b6885efb5..644a77876 100644 --- a/src/Domains/Inventory/Attributes/Models/Attributes.php +++ b/src/Domains/Inventory/Attributes/Models/Attributes.php @@ -12,7 +12,7 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; +use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Variants\Models\VariantsAttributes; /** diff --git a/src/Domains/Inventory/Categories/Models/Categories.php b/src/Domains/Inventory/Categories/Models/Categories.php index 2dbeb1ff8..080946650 100644 --- a/src/Domains/Inventory/Categories/Models/Categories.php +++ b/src/Domains/Inventory/Categories/Models/Categories.php @@ -12,7 +12,7 @@ use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Products\Models\ProductsCategories; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; +use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\ScopesTrait; class Categories extends BaseModel diff --git a/src/Domains/Inventory/Channels/Models/Channels.php b/src/Domains/Inventory/Channels/Models/Channels.php index 4539dea78..a10857c82 100644 --- a/src/Domains/Inventory/Channels/Models/Channels.php +++ b/src/Domains/Inventory/Channels/Models/Channels.php @@ -12,7 +12,7 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; +use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsChannels; diff --git a/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php b/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php index 3ff2cc504..936022192 100644 --- a/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php +++ b/src/Domains/Inventory/ProductsTypes/Models/ProductsTypes.php @@ -16,7 +16,7 @@ use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Products\Factories\ProductTypeFactory; use Kanvas\Inventory\Products\Models\Products; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; +use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\ScopesTrait; /** diff --git a/src/Domains/Inventory/Status/Models/Status.php b/src/Domains/Inventory/Status/Models/Status.php index a16555a3c..7b3641164 100644 --- a/src/Domains/Inventory/Status/Models/Status.php +++ b/src/Domains/Inventory/Status/Models/Status.php @@ -7,7 +7,7 @@ use Baka\Traits\SlugTrait; use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\Inventory\Models\BaseModel; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; +use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; diff --git a/src/Domains/Inventory/Warehouses/Models/Warehouses.php b/src/Domains/Inventory/Warehouses/Models/Warehouses.php index 9e94b79e9..09df6e1d0 100644 --- a/src/Domains/Inventory/Warehouses/Models/Warehouses.php +++ b/src/Domains/Inventory/Warehouses/Models/Warehouses.php @@ -4,6 +4,7 @@ namespace Kanvas\Inventory\Warehouses\Models; +use Baka\Traits\DatabaseSearchableTrait; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -11,7 +12,6 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Inventory\Models\BaseModel; use Kanvas\Inventory\Regions\Models\Regions; -use Kanvas\Inventory\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\VariantsWarehouses; From a3d2402971817dd694b62f94ac5105d8a37da0ad Mon Sep 17 00:00:00 2001 From: Rafael White Date: Thu, 13 Jun 2024 11:58:40 -0400 Subject: [PATCH 121/140] add restart for queues and scheduler --- .github/workflows/ec2-deploy.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 8a7880776..2017d8bd1 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -42,3 +42,7 @@ jobs: docker compose -f docker-compose.dev.yml up -d docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache docker exec -i phpkanvas-ecosystem php artisan config:cache + docker restart queue + docker restart queue-notifications + docker restart queue-social + docker restart laravel-scheduler From a4b27af724795fd8020dca4975e120714794084e Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 13 Jun 2024 11:59:51 -0400 Subject: [PATCH 122/140] feat: add id --- graphql/schemas/ActionEngine/task.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index 8f3a63122..2d0f488ed 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -18,6 +18,7 @@ type TaskListItem { } type LeadTaskEngagementItem { + id: ID! name: String! company_action: CompanyAction! @belongsTo(relation: "companyAction") status: String From 0e08d45e3d9830a2505a84bf099d576cf1276ccf Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 13:23:57 -0400 Subject: [PATCH 123/140] Add type pivot table --- graphql/schemas/Inventory/variantChannel.graphql | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/graphql/schemas/Inventory/variantChannel.graphql b/graphql/schemas/Inventory/variantChannel.graphql index e8d380076..7506e1dd0 100644 --- a/graphql/schemas/Inventory/variantChannel.graphql +++ b/graphql/schemas/Inventory/variantChannel.graphql @@ -30,10 +30,11 @@ type ChannelsPricesHistoryRelationship { from_date: String! } type VariantChannelRelationship { + id: ID! name: String - price: Float - warehouses_id: Int - discounted_price: Float + description: String + slug: String + pivot: VariantChannelPivot is_published: Boolean prices_history: [ChannelsPricesHistoryRelationship!]! @field( @@ -41,6 +42,14 @@ type VariantChannelRelationship { ) } +type VariantChannelPivot { + price: Float + channels_id: ID! + warehouses_id: ID! + discounted_price: Float + is_published: Boolean +} + input VariantChannelInput { price: Float! discounted_price: Float! From 264f21d56d563a6abb24705669a112f4cdf57083 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 13:24:15 -0400 Subject: [PATCH 124/140] add channels_id to pivot data --- src/Domains/Inventory/Variants/Models/Variants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index 531060e7c..af31334cb 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -180,7 +180,7 @@ public function channels(): BelongsToMany 'products_variants_id', 'channels_id' ) - ->withPivot('price', 'discounted_price', 'is_published', 'warehouses_id'); + ->withPivot('price', 'discounted_price', 'is_published', 'warehouses_id', 'channels_id'); } /** From d9fffb23c962e4b6419537c6b68f7402ed44ab9b Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 13 Jun 2024 14:29:59 -0400 Subject: [PATCH 125/140] refact: checklist update --- .../Engagements/TaskEngagementMutation.php | 28 +++++++++++++++---- graphql/schemas/ActionEngine/task.graphql | 2 +- src/Baka/Traits/KanvasModelTrait.php | 6 ++-- .../Tasks/Models/TaskEngagementItem.php | 5 ++++ .../Models/VariantWarehouseStatusHistory.php | 1 - 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php b/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php index b3e75a845..2e897fe1c 100644 --- a/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php +++ b/app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.php @@ -4,9 +4,11 @@ namespace App\GraphQL\ActionEngine\Mutations\Engagements; +use Kanvas\ActionEngine\Tasks\Models\TaskEngagementItem; use Kanvas\ActionEngine\Tasks\Models\TaskListItem; use Kanvas\Apps\Models\Apps; use Kanvas\Exceptions\ValidationException; +use Kanvas\Guild\Leads\Models\Lead; class TaskEngagementMutation { @@ -17,19 +19,35 @@ public function changeEngagementTaskItemStatus(mixed $rootValue, array $request) $company = $user->getCurrentCompany(); $app = app(Apps::class); $status = $request['status']; + $lead = Lead::getByIdFromCompanyApp($request['lead_id'], $company, $app); $taskListItem = TaskListItem::getById($id); - if ($taskListItem->companyAction->company_id != $company->getId()) { - throw new ValidationException('You are not allowed to change the status of this task'); + if ($taskListItem->companyAction->companies_id != $company->getId()) { + throw new ValidationException('You are not allowed to change the status of this task , company mismatch'); } if ($taskListItem->companyAction->apps_id != $app->getId()) { - throw new ValidationException('You are not allowed to change the status of this task'); + throw new ValidationException('You are not allowed to change the status of this task , app mismatch'); } - $taskListItem->status = $status; + $taskEngagementItem = TaskEngagementItem::fromCompany($company) + ->fromApp($app) + ->where('task_list_item_id', $taskListItem->getId()) + ->where('lead_id', $lead->getId()) + ->first(); + + if (! $taskEngagementItem) { + $taskEngagementItem = new TaskEngagementItem(); + $taskEngagementItem->task_list_item_id = $taskListItem->getId(); + $taskEngagementItem->lead_id = $lead->getId(); + $taskEngagementItem->companies_id = $company->getId(); + $taskEngagementItem->apps_id = $app->getId(); + $taskEngagementItem->users_id = $user->getId(); + } + + $taskEngagementItem->status = $status; - return $taskListItem->saveOrFail(); + return $taskEngagementItem->saveOrFail(); } } diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index 2d0f488ed..c86314b95 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -38,7 +38,7 @@ extend type Query @guard { } extend type Mutation @guard { - changeTaskEngagementItemStatus(id: ID!, status: String!): Boolean! + changeTaskEngagementItemStatus(id: ID!, lead_id: ID!, status: String!): Boolean! @field( resolver: "App\\GraphQL\\ActionEngine\\Mutations\\Engagements\\TaskEngagementMutation@changeEngagementTaskItemStatus" ) diff --git a/src/Baka/Traits/KanvasModelTrait.php b/src/Baka/Traits/KanvasModelTrait.php index 2edbad36b..1a1b74560 100644 --- a/src/Baka/Traits/KanvasModelTrait.php +++ b/src/Baka/Traits/KanvasModelTrait.php @@ -43,7 +43,7 @@ public static function getByName(string $name, ?AppInterface $app = null): self ->firstOrFail(); } catch (ModelNotFoundException $e) { //we want to expose the not found msg - throw new ExceptionsModelNotFoundException("No record found for $name"); + throw new ExceptionsModelNotFoundException($e->getMessage() . " $name"); } } @@ -58,7 +58,7 @@ public static function getByUuid(string $uuid, ?AppInterface $app = null): self ->firstOrFail(); } catch (ModelNotFoundException $e) { //we want to expose the not found msg - throw new ExceptionsModelNotFoundException("No record found for $uuid"); + throw new ExceptionsModelNotFoundException($e->getMessage() . " $uuid"); } } @@ -73,7 +73,7 @@ public static function getById(mixed $id, ?AppInterface $app = null): self ->firstOrFail(); } catch (ModelNotFoundException $e) { //we want to expose the not found msg - throw new ExceptionsModelNotFoundException("No record found for $id"); + throw new ExceptionsModelNotFoundException($e->getMessage() . " $id"); } } diff --git a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php index 423403adf..695ffc94b 100644 --- a/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php +++ b/src/Domains/ActionEngine/Tasks/Models/TaskEngagementItem.php @@ -5,6 +5,7 @@ namespace Kanvas\ActionEngine\Tasks\Models; use Baka\Casts\Json; +use Baka\Traits\HasCompositePrimaryKeyTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasOne; use Kanvas\ActionEngine\Engagements\Models\Engagement; @@ -25,6 +26,8 @@ */ class TaskEngagementItem extends BaseModel { + use HasCompositePrimaryKeyTrait; + protected $table = 'company_task_engagement_items'; protected $guarded = []; @@ -32,6 +35,8 @@ class TaskEngagementItem extends BaseModel 'config' => Json::class, ]; + protected $primaryKey = ['task_list_item_id','lead_id']; + public function item(): BelongsTo { return $this->belongsTo(TaskListItem::class, 'task_list_item_id'); diff --git a/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php b/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php index 05f52ad42..64de52a76 100644 --- a/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php +++ b/src/Domains/Inventory/Status/Models/VariantWarehouseStatusHistory.php @@ -30,7 +30,6 @@ class VariantWarehouseStatusHistory extends BaseModel protected $primaryKey = ['products_variants_warehouse_id', 'status_id']; protected $forceDeleting = true; - /** * Get the user that owns the Variants. */ From 67cd727aa8257d85f2843ef74f85a535c4e756dc Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 15:38:51 -0400 Subject: [PATCH 126/140] Add inventory quantity --- graphql/schemas/Inventory/variant.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index 27473bf59..f82194e06 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -35,6 +35,7 @@ type Variant { defaultCount: 25 builder: "App\\GraphQL\\Ecosystem\\Queries\\CustomFields\\CustomFieldQuery@getAllByGraphType" ) + inventory_quantity: Int @method(name: "getTotalQuantity") } type VariantPricingInfo{ From eae4dbd576da6275365cf9d144e3111cff3e9f88 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 15:39:05 -0400 Subject: [PATCH 127/140] update inventory quantity on create update --- .../Warehouses/Observers/VariantsWarehouseObserver.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Domains/Inventory/Warehouses/Observers/VariantsWarehouseObserver.php b/src/Domains/Inventory/Warehouses/Observers/VariantsWarehouseObserver.php index 14738a94a..6a5e08109 100644 --- a/src/Domains/Inventory/Warehouses/Observers/VariantsWarehouseObserver.php +++ b/src/Domains/Inventory/Warehouses/Observers/VariantsWarehouseObserver.php @@ -25,6 +25,11 @@ public function saved(VariantsWarehouses $variantWarehouse): void 'total_products', $variantWarehouse->getTotalProducts() ); + + $variantWarehouse->variant->set( + 'total_variant_quantity', + $variantWarehouse->variant->setTotalQuantity() + ); } if ($variantWarehouse->wasChanged('status_id')) { @@ -41,5 +46,10 @@ public function created(VariantsWarehouses $variantWarehouse): void 'total_products', $variantWarehouse->getTotalProducts() ); + + $variantWarehouse->variant->set( + 'total_variant_quantity', + $variantWarehouse->variant->setTotalQuantity() + ); } } From 73cafe3816a56835cc92c80f2f10dc1e26742d42 Mon Sep 17 00:00:00 2001 From: arfenis Date: Thu, 13 Jun 2024 15:39:27 -0400 Subject: [PATCH 128/140] add method to sum quantity inventory --- .../Inventory/Variants/Models/Variants.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index 531060e7c..597d786fe 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -328,4 +328,36 @@ protected function makeAllSearchableUsing(Builder $query): Builder { return $query->whereRelation('warehouses', 'warehouses.is_deleted', 0); } + + /** + * Get the total amount of variants in all the warehouses. + * + * @return Int + */ + public function getTotalQuantity(): int + { + if (! $totalVariantQuantity = $this->get('total_variant_quantity')) { + return (int) $this->setTotalQuantity(); + } + return (int) $totalVariantQuantity; + } + + /** + * Set the total amount of variants in all the warehouses. + * + * @return Int + */ + public function setTotalQuantity(): int + { + $total = $this->variantWarehouses() + ->where('is_deleted', 0) + ->sum('quantity'); + + $this->set( + 'total_variant_quantity', + $total + ); + + return (int) $total; + } } From 31568971de9914fc04b2ab9475508b6692c3047d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:24:28 +0000 Subject: [PATCH 129/140] build(deps): bump spatie/laravel-data from 4.6.0 to 4.7.0 Bumps [spatie/laravel-data](https://github.com/spatie/laravel-data) from 4.6.0 to 4.7.0. - [Release notes](https://github.com/spatie/laravel-data/releases) - [Changelog](https://github.com/spatie/laravel-data/blob/main/CHANGELOG.md) - [Commits](https://github.com/spatie/laravel-data/compare/4.6.0...4.7.0) --- updated-dependencies: - dependency-name: spatie/laravel-data dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index d1125354f..73a95d0ff 100644 --- a/composer.lock +++ b/composer.lock @@ -8982,16 +8982,16 @@ }, { "name": "spatie/laravel-data", - "version": "4.6.0", + "version": "4.7.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-data.git", - "reference": "ee513f693f8ab8f915dc26cae079d7b2e5999a65" + "reference": "92af136b14f57c72b1b8e36cd5f7e274fb56385a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-data/zipball/ee513f693f8ab8f915dc26cae079d7b2e5999a65", - "reference": "ee513f693f8ab8f915dc26cae079d7b2e5999a65", + "url": "https://api.github.com/repos/spatie/laravel-data/zipball/92af136b14f57c72b1b8e36cd5f7e274fb56385a", + "reference": "92af136b14f57c72b1b8e36cd5f7e274fb56385a", "shasum": "" }, "require": { @@ -9004,7 +9004,7 @@ "require-dev": { "fakerphp/faker": "^1.14", "friendsofphp/php-cs-fixer": "^3.0", - "inertiajs/inertia-laravel": "dev-master#4508fd1", + "inertiajs/inertia-laravel": "^1.2", "livewire/livewire": "^3.0", "mockery/mockery": "^1.6", "nesbot/carbon": "^2.63", @@ -9054,7 +9054,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-data/issues", - "source": "https://github.com/spatie/laravel-data/tree/4.6.0" + "source": "https://github.com/spatie/laravel-data/tree/4.7.0" }, "funding": [ { @@ -9062,7 +9062,7 @@ "type": "github" } ], - "time": "2024-05-03T15:01:04+00:00" + "time": "2024-06-13T12:07:24+00:00" }, { "name": "spatie/laravel-google-cloud-storage", From 8a55b0260013f3795183690f5e46b36de39eff8d Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 07:55:49 -0400 Subject: [PATCH 130/140] refact : type --- graphql/schemas/Inventory/variant.graphql | 11 ++++++++--- graphql/schemas/Inventory/variantChannel.graphql | 3 ++- src/Domains/Inventory/Variants/Models/Variants.php | 7 ++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index f82194e06..c876fcfe4 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -26,10 +26,15 @@ type Variant { attributes: [VariantsAttributes!]! companies: Company! @belongsTo(relation: "company") channels: [VariantChannelRelationship!]! + @BelongsToMany(relation: "channels") channel: VariantPricingInfo - @field(resolver: "App\\GraphQL\\Inventory\\Types\\ChannelInfoType@price") + @field( + resolver: "App\\GraphQL\\Inventory\\Types\\ChannelInfoType@price" + ) metadata: Mixed - @field(resolver: "App\\GraphQL\\Inventory\\Types\\MetadataType@linkedStores") + @field( + resolver: "App\\GraphQL\\Inventory\\Types\\MetadataType@linkedStores" + ) custom_fields: [CustomField!]! @paginate( defaultCount: 25 @@ -38,7 +43,7 @@ type Variant { inventory_quantity: Int @method(name: "getTotalQuantity") } -type VariantPricingInfo{ +type VariantPricingInfo { price: Float! discounted_price: Float! quantity: Int! diff --git a/graphql/schemas/Inventory/variantChannel.graphql b/graphql/schemas/Inventory/variantChannel.graphql index 7506e1dd0..563e89fc9 100644 --- a/graphql/schemas/Inventory/variantChannel.graphql +++ b/graphql/schemas/Inventory/variantChannel.graphql @@ -133,7 +133,8 @@ extend type Query { id: ID! attributes: Mixed search: String @search - where: _ @whereConditions(columnsEnum: ChannelVariantsFilterByAttributesEnum) + where: _ + @whereConditions(columnsEnum: ChannelVariantsFilterByAttributesEnum) orderBy: _ @orderBy( columns: [ diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index 4d72ad1a7..6695be94c 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -224,7 +224,7 @@ public function addAttributes(UserInterface $user, array $attributes): void 'isVisible' => false, 'isSearchable' => false, 'isFiltrable' => false, - 'slug' => Str::slug($attribute['name']) + 'slug' => Str::slug($attribute['name']), ]); $attributeModel = (new CreateAttribute($attributesDto, $user))->execute(); } @@ -331,21 +331,18 @@ protected function makeAllSearchableUsing(Builder $query): Builder /** * Get the total amount of variants in all the warehouses. - * - * @return Int */ public function getTotalQuantity(): int { if (! $totalVariantQuantity = $this->get('total_variant_quantity')) { return (int) $this->setTotalQuantity(); } + return (int) $totalVariantQuantity; } /** * Set the total amount of variants in all the warehouses. - * - * @return Int */ public function setTotalQuantity(): int { From 8d0a8b109a6bcbef08468706d902da53275d1402 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 08:41:29 -0400 Subject: [PATCH 131/140] refact: channel variant relationship --- graphql/schemas/Inventory/variant.graphql | 2 +- .../schemas/Inventory/variantChannel.graphql | 12 +--- .../Inventory/Channels/Models/Channels.php | 58 +++++++++---------- src/Kanvas/Enums/AppEnums.php | 2 +- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/graphql/schemas/Inventory/variant.graphql b/graphql/schemas/Inventory/variant.graphql index c876fcfe4..3cf0798f9 100644 --- a/graphql/schemas/Inventory/variant.graphql +++ b/graphql/schemas/Inventory/variant.graphql @@ -23,7 +23,7 @@ type Variant { product: Product warehouses: [WarehouseVariantRelationship!]! @hasMany(relation: "variantWarehouses") - attributes: [VariantsAttributes!]! + attributes: [VariantsAttributes!]! @BelongsToMany(relation: "attributes") companies: Company! @belongsTo(relation: "company") channels: [VariantChannelRelationship!]! @BelongsToMany(relation: "channels") diff --git a/graphql/schemas/Inventory/variantChannel.graphql b/graphql/schemas/Inventory/variantChannel.graphql index 563e89fc9..fa8193996 100644 --- a/graphql/schemas/Inventory/variantChannel.graphql +++ b/graphql/schemas/Inventory/variantChannel.graphql @@ -33,8 +33,10 @@ type VariantChannelRelationship { id: ID! name: String description: String + price: Float + discounted_price: Float + warehouses_id: ID! slug: String - pivot: VariantChannelPivot is_published: Boolean prices_history: [ChannelsPricesHistoryRelationship!]! @field( @@ -42,14 +44,6 @@ type VariantChannelRelationship { ) } -type VariantChannelPivot { - price: Float - channels_id: ID! - warehouses_id: ID! - discounted_price: Float - is_published: Boolean -} - input VariantChannelInput { price: Float! discounted_price: Float! diff --git a/src/Domains/Inventory/Channels/Models/Channels.php b/src/Domains/Inventory/Channels/Models/Channels.php index a10857c82..3599bc880 100644 --- a/src/Domains/Inventory/Channels/Models/Channels.php +++ b/src/Domains/Inventory/Channels/Models/Channels.php @@ -4,19 +4,15 @@ namespace Kanvas\Inventory\Channels\Models; +use Baka\Traits\DatabaseSearchableTrait; use Baka\Traits\SlugTrait; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Casts\Attribute; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; -use Kanvas\Apps\Models\Apps; -use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; -use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Traits\DefaultTrait; use Kanvas\Inventory\Variants\Models\Variants; use Kanvas\Inventory\Variants\Models\VariantsChannels; -use Kanvas\Users\Models\Users; /** * Class Channels. @@ -44,30 +40,6 @@ class Channels extends BaseModel protected $table = 'channels'; protected $guarded = []; - /** - * Get the companies that owns the Warehouses. - */ - public function companies(): BelongsTo - { - return $this->belongsTo(Companies::class, 'companies_id'); - } - - /** - * - */ - public function apps(): BelongsTo - { - return $this->belongsTo(Apps::class, 'apps_id'); - } - - /** - * users. - */ - public function users(): BelongsTo - { - return $this->belongsTo(Users::class, 'users_id'); - } - /** * Available products in this channel */ @@ -99,4 +71,32 @@ public function pricesHistory(): HasMany 'channels_id' ); } + + public function price(): Attribute + { + return Attribute::make( + get: fn () => $this->pivot->price, + ); + } + + public function discountedPrice(): Attribute + { + return Attribute::make( + get: fn () => $this->pivot->discounted_price, + ); + } + + public function isPublished(): Attribute + { + return Attribute::make( + get: fn () => $this->pivot->is_published, + ); + } + + public function warehousesId(): Attribute + { + return Attribute::make( + get: fn () => $this->pivot->warehouses_id, + ); + } } diff --git a/src/Kanvas/Enums/AppEnums.php b/src/Kanvas/Enums/AppEnums.php index 9d9bae31a..11ddbeec0 100644 --- a/src/Kanvas/Enums/AppEnums.php +++ b/src/Kanvas/Enums/AppEnums.php @@ -96,7 +96,7 @@ public function getValue(): mixed self::KANVAS_APP_REGION_HEADER => 'X-Kanvas-Region', self::KANVAS_APP_COMPANY_AUTH_HEADER => 'Company-Authorization', //@deprecated self::DISPLAYNAME_LOGIN => 'displayname_login', - self::VERSION => '1.0-BETA-35', + self::VERSION => '1.0-BETA-36', self::ANONYMOUS_USER_ID => -1, self::DEFAULT_APP_JWT_TOKEN_NAME => 'kanvas-login', }; From 66d32df6bc3b1a6b846e2179a1d2ad8748e818cb Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 10:55:03 -0400 Subject: [PATCH 132/140] refact : cache --- src/Domains/Inventory/Channels/Models/Channels.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Domains/Inventory/Channels/Models/Channels.php b/src/Domains/Inventory/Channels/Models/Channels.php index 3599bc880..5a3b0673c 100644 --- a/src/Domains/Inventory/Channels/Models/Channels.php +++ b/src/Domains/Inventory/Channels/Models/Channels.php @@ -86,10 +86,10 @@ public function discountedPrice(): Attribute ); } - public function isPublished(): Attribute + protected function isPublished(): Attribute { return Attribute::make( - get: fn () => $this->pivot->is_published, + get: fn () => $this->pivot ? $this->pivot->is_published : ($this->attributes['is_published'] ?? true), ); } From a381bae26d71d6a96b17ad7d9ddf67f4c695e868 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 10:56:20 -0400 Subject: [PATCH 133/140] refact : cache --- src/Domains/Inventory/Channels/Models/Channels.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Channels/Models/Channels.php b/src/Domains/Inventory/Channels/Models/Channels.php index 5a3b0673c..95127c83a 100644 --- a/src/Domains/Inventory/Channels/Models/Channels.php +++ b/src/Domains/Inventory/Channels/Models/Channels.php @@ -86,7 +86,7 @@ public function discountedPrice(): Attribute ); } - protected function isPublished(): Attribute + public function isPublished(): Attribute { return Attribute::make( get: fn () => $this->pivot ? $this->pivot->is_published : ($this->attributes['is_published'] ?? true), From 82595a9c9c776fff5e05254e5f3b4be91652321a Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 17:20:56 -0400 Subject: [PATCH 134/140] fix: permission issue --- src/Kanvas/Companies/Repositories/CompaniesRepository.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Kanvas/Companies/Repositories/CompaniesRepository.php b/src/Kanvas/Companies/Repositories/CompaniesRepository.php index 2f72f8f8a..abd8a4730 100644 --- a/src/Kanvas/Companies/Repositories/CompaniesRepository.php +++ b/src/Kanvas/Companies/Repositories/CompaniesRepository.php @@ -88,6 +88,10 @@ public static function userAssociatedToCompany(Companies $company, Users $user): */ public static function userAssociatedToCompanyAndBranch(Companies $company, CompaniesBranches $branch, Users $user): UsersAssociatedCompanies { + if ($user->isAppOwner()) { + return new UsersAssociatedCompanies(); + } + try { return UsersAssociatedCompanies::where('users_id', $user->getKey()) ->where('companies_id', $company->getKey()) From 1d2f3fc0567d2a32563fbe4cee809193aa1de225 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 17:23:14 -0400 Subject: [PATCH 135/140] fix: permission issue --- src/Kanvas/Companies/Repositories/CompaniesRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kanvas/Companies/Repositories/CompaniesRepository.php b/src/Kanvas/Companies/Repositories/CompaniesRepository.php index abd8a4730..3b6252c40 100644 --- a/src/Kanvas/Companies/Repositories/CompaniesRepository.php +++ b/src/Kanvas/Companies/Repositories/CompaniesRepository.php @@ -91,7 +91,7 @@ public static function userAssociatedToCompanyAndBranch(Companies $company, Comp if ($user->isAppOwner()) { return new UsersAssociatedCompanies(); } - + try { return UsersAssociatedCompanies::where('users_id', $user->getKey()) ->where('companies_id', $company->getKey()) From e2bf1345f80a74a55e4967c4c638563e840b6827 Mon Sep 17 00:00:00 2001 From: kaioken Date: Fri, 14 Jun 2024 17:42:37 -0400 Subject: [PATCH 136/140] refact: fix task is deleted --- graphql/schemas/ActionEngine/task.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql/schemas/ActionEngine/task.graphql b/graphql/schemas/ActionEngine/task.graphql index c86314b95..69bc1e1ea 100644 --- a/graphql/schemas/ActionEngine/task.graphql +++ b/graphql/schemas/ActionEngine/task.graphql @@ -34,6 +34,7 @@ extend type Query @guard { @paginate( builder: "App\\GraphQL\\ActionEngine\\Builders\\Engagements\\TaskEngagementBuilder@getLeadTaskItems" defaultCount: 25 + scopes: ["notDeleted"] ) } From d2bb8aaa037eb2411b38a488907702cb975512ff Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 16 Jun 2024 00:26:53 -0400 Subject: [PATCH 137/140] feat: new connector --- .../Activities/UserCustomFieldActivity.php | 38 +++++++++++++++++++ .../Workflows/UserCustomFieldWorkflow.php | 22 +++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php create mode 100644 src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php diff --git a/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php b/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php new file mode 100644 index 000000000..3dd0f1921 --- /dev/null +++ b/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php @@ -0,0 +1,38 @@ +overwriteAppService($app); + + $customField = $params['customField'] ?? null; + + if (! $customField) { + return ['No custom field configured to set for user']; + } + + //set custom field to user + foreach ($customField as $key => $value) { + $user->set($key, $value); + } + + return [ + 'user_id' => $user->getId(), + 'custom_field' => $customField, + ]; + } +} diff --git a/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php b/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php new file mode 100644 index 000000000..f7901aeba --- /dev/null +++ b/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php @@ -0,0 +1,22 @@ + Date: Sun, 16 Jun 2024 00:28:56 -0400 Subject: [PATCH 138/140] feat: new connector --- .../Connectors/Internal/Workflows/UserCustomFieldWorkflow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php b/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php index f7901aeba..d7e9c8d18 100644 --- a/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php +++ b/src/Domains/Connectors/Internal/Workflows/UserCustomFieldWorkflow.php @@ -19,4 +19,4 @@ public function execute(AppInterface $app, UserInterface $user, array $params): return $result; } -} \ No newline at end of file +} From b463c4c8ee100ea2088d283318b4bf1d13ee7e68 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 16 Jun 2024 13:07:53 -0400 Subject: [PATCH 139/140] refact: change visibility --- .../Internal/Activities/UserCustomFieldActivity.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php b/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php index 3dd0f1921..ace16e323 100644 --- a/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php +++ b/src/Domains/Connectors/Internal/Activities/UserCustomFieldActivity.php @@ -27,7 +27,9 @@ public function execute(Model $user, AppInterface $app, array $params): array //set custom field to user foreach ($customField as $key => $value) { - $user->set($key, $value); + $value = $value['value'] ?? null; + $isPublic = $value['is_public'] ?? false; + $user->set($key, $value, $isPublic); } return [ From 0dc639ad4663f08e135425f8f2e30ebcd6272f9c Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 16 Jun 2024 13:14:32 -0400 Subject: [PATCH 140/140] refact: change visibility --- composer.lock | 75 ++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/composer.lock b/composer.lock index 73a95d0ff..10b2aae9d 100644 --- a/composer.lock +++ b/composer.lock @@ -1195,16 +1195,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.311.2", + "version": "3.314.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "731cd73062909594c5f7443413c4c4c40ed1c25c" + "reference": "1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/731cd73062909594c5f7443413c4c4c40ed1c25c", - "reference": "731cd73062909594c5f7443413c4c4c40ed1c25c", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef", + "reference": "1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef", "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.311.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.314.2" }, - "time": "2024-06-07T18:05:33+00:00" + "time": "2024-06-14T18:11:34+00:00" }, { "name": "berkayk/onesignal-laravel", @@ -2503,16 +2503,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.358.0", + "version": "v0.359.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd" + "reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd", - "reference": "a6daf60ee25cb45b6e3dbd04b62d1df39a609fbd", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338", + "reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338", "shasum": "" }, "require": { @@ -2541,9 +2541,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.358.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.359.0" }, - "time": "2024-06-03T01:02:16+00:00" + "time": "2024-06-10T01:02:17+00:00" }, { "name": "google/auth", @@ -8018,16 +8018,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.3", + "version": "v0.12.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", - "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/2fd717afa05341b4f8152547f142cd2f130f6818", + "reference": "2fd717afa05341b4f8152547f142cd2f130f6818", "shasum": "" }, "require": { @@ -8091,9 +8091,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.4" }, - "time": "2024-04-02T15:57:53+00:00" + "time": "2024-06-10T01:18:23+00:00" }, { "name": "ralouphie/getallheaders", @@ -13446,16 +13446,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.12.1", + "version": "v15.12.2", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "d8ea59bb02af10fd58a1192f7a781ae8aedac2d6" + "reference": "21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/d8ea59bb02af10fd58a1192f7a781ae8aedac2d6", - "reference": "d8ea59bb02af10fd58a1192f7a781ae8aedac2d6", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f", + "reference": "21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f", "shasum": "" }, "require": { @@ -13508,7 +13508,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.12.1" + "source": "https://github.com/webonyx/graphql-php/tree/v15.12.2" }, "funding": [ { @@ -13516,7 +13516,7 @@ "type": "open_collective" } ], - "time": "2024-06-11T12:48:47+00:00" + "time": "2024-06-13T07:28:14+00:00" } ], "packages-dev": [ @@ -13867,16 +13867,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -13884,11 +13884,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -13914,7 +13915,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -13922,7 +13923,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nunomaduro/collision", @@ -14522,16 +14523,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.1", + "version": "11.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b8775732e9c401bda32df3ffbdf90dec7533ceb" + "reference": "3e1843a58adc9c433ee6170bdee7d615f7ccc20b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b8775732e9c401bda32df3ffbdf90dec7533ceb", - "reference": "1b8775732e9c401bda32df3ffbdf90dec7533ceb", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e1843a58adc9c433ee6170bdee7d615f7ccc20b", + "reference": "3e1843a58adc9c433ee6170bdee7d615f7ccc20b", "shasum": "" }, "require": { @@ -14602,7 +14603,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.1" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.2" }, "funding": [ { @@ -14618,7 +14619,7 @@ "type": "tidelift" } ], - "time": "2024-06-11T07:30:35+00:00" + "time": "2024-06-15T09:14:53+00:00" }, { "name": "sebastian/cli-parser",