From a03e3d9fb0b66de987305cb1cad654f36c4919a9 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Tue, 11 Jun 2024 23:31:55 -0400 Subject: [PATCH 01/58] feat: screening people --- ...6_11_215748_peoples_employment_history.php | 41 +++++++++++++++ .../Customers/Actions/ScreeningAction.php | 48 +++++++++++++++++ src/Domains/Guild/Customers/Models/People.php | 9 ++++ .../Models/PeopleEmploymentHistory.php | 23 +++++++++ .../Activities/ScreeningPeopleActivity.php | 51 +++++++++++++++++++ 5 files changed, 172 insertions(+) create mode 100644 database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php create mode 100644 src/Domains/Guild/Customers/Actions/ScreeningAction.php create mode 100644 src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php create mode 100644 src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php new file mode 100644 index 0000000000..1fd0caef37 --- /dev/null +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -0,0 +1,41 @@ +id(); + $table->integer('peoples_id')->unsigned(); + $table->string('position'); + $table->decimal('income', 10, 2); + $table->date('start_date'); + $table->date('end_date')->nullable(); + $table->integer('status')->default(0); + $table->string('income_type'); + $table->string('company_employer_name'); + $table->string('company_employer_address')->nullable(); + $table->string('company_employer_phone')->nullable(); + $table->string('company_employer_email')->nullable(); + $table->string('company_employer_city')->nullable(); + $table->string('company_employer_state')->nullable(); + $table->string('company_employer_zip')->nullable(); + $table->boolean('is_deleted')->default(0); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('peoples_employment_history'); + } +}; diff --git a/src/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Guild/Customers/Actions/ScreeningAction.php new file mode 100644 index 0000000000..260a4cae30 --- /dev/null +++ b/src/Domains/Guild/Customers/Actions/ScreeningAction.php @@ -0,0 +1,48 @@ +people->getEmails(); + $data = [ + 'first_name' => $this->people->firstname, + 'last_name' => $this->people->lastname, + 'name' => $this->people->getName(), + 'email' => $email ? $email->value : null, + 'reveal_personal_email' => true, + 'reveal_phone_number' => true, + ]; + try { + // Envía la solicitud POST a la API de Apollo.io + $response = $client->post('https://api.apollo.io/v1/people/match', [ + 'headers' => [ + 'Content-Type' => 'application/json', + 'Cache-Control' => 'no-cache', + 'X-Api-Key' => $apiKey, + ], + 'json' => $data, + ]); + + return json_decode($response->getBody()->getContents(), true)["person"]; + + } catch (GuzzleException $e) { + echo 'Error de Guzzle: ' . $e->getMessage(); + } + + } +} diff --git a/src/Domains/Guild/Customers/Models/People.php b/src/Domains/Guild/Customers/Models/People.php index 55af8b4289..7932ab79fa 100644 --- a/src/Domains/Guild/Customers/Models/People.php +++ b/src/Domains/Guild/Customers/Models/People.php @@ -73,6 +73,15 @@ public function emails(): HasMany ); } + public function peoplesEmploymentHistory(): HasMany + { + return $this->hasMany( + PeopleEmploymentHistory::class, + 'peoples_id', + 'id' + ); + } + public function phones(): HasMany { return $this->hasMany( diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php new file mode 100644 index 0000000000..a527250854 --- /dev/null +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -0,0 +1,23 @@ +execute(); + $contactType = ContactType::firstOrCreate([ + 'name' => 'LinkedIn', + 'users_id' => AppEnums::DEFAULT_USER_ID, + 'companies_id' => AppEnums::DEFAULT_COMPANY_ID + ]); + $people->contacts()->create([ + 'contacts_types_id' => $contactType->id, + 'value' => $peopleData['linkedin'], + 'weight' => 1 + ]); + $history = []; + foreach($peopleData['employment_history'] as $employmentHistory) { + $history[] = PeopleEmploymentHistory::create([ + 'peoples_id' => $people->id, + 'company_employer_name' => $employmentHistory['organization_name'], + 'position' => $employmentHistory['position'], + 'start_date' => $employmentHistory['start_date'], + 'end_date' => $employmentHistory['end_date'], + 'position' => $employmentHistory['title'], + 'address' => $employmentHistory['raw_address'], + ]); + } + $people->peoplesEmploymentHistory()->saveMany($history); + return [ + 'status' => 'success', + 'message' => 'People screened successfully', + 'people' => $people->id, + ]; + } +} From 58bf136ebc051cc00cf000e64855a56ee90aced4 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 13 Jun 2024 15:53:25 -0400 Subject: [PATCH 02/58] refactor: people data --- ...6_11_215748_peoples_employment_history.php | 7 ++- graphql/schemas/Guild/people.graphql | 21 +++++++++ .../Customers/Actions/CreatePeopleAction.php | 8 ++++ .../Customers/Actions/ScreeningAction.php | 18 ++++--- src/Domains/Guild/Customers/Models/People.php | 2 + .../Models/PeopleEmploymentHistory.php | 32 +++++++++++-- .../Activities/ScreeningPeopleActivity.php | 47 ++++++++++--------- 7 files changed, 101 insertions(+), 34 deletions(-) diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index 1fd0caef37..9bf44720e8 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -14,12 +14,13 @@ public function up(): void Schema::create('peoples_employment_history', function (Blueprint $table) { $table->id(); $table->integer('peoples_id')->unsigned(); + $table->integer('apps_id')->unsigned(); $table->string('position'); - $table->decimal('income', 10, 2); + $table->decimal('income', 10, 2)->nullable(); $table->date('start_date'); $table->date('end_date')->nullable(); $table->integer('status')->default(0); - $table->string('income_type'); + $table->string('income_type')->nullable(); $table->string('company_employer_name'); $table->string('company_employer_address')->nullable(); $table->string('company_employer_phone')->nullable(); @@ -28,6 +29,8 @@ public function up(): void $table->string('company_employer_state')->nullable(); $table->string('company_employer_zip')->nullable(); $table->boolean('is_deleted')->default(0); + $table->dateTime('created_at')->index('created_at'); + $table->dateTime('updated_at')->nullable()->index('updated_at'); }); } diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 6877e96e96..cf6889b93a 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -10,6 +10,10 @@ type People { dob: Date contacts: [Contact!]! @hasMany address: [Address!]! @hasMany + peoplesEmploymentHistory: [PeopleEmploymentHistory!]! + @hasMany( + relation: "peoplesEmploymentHistory" + ) files: [Filesystem!]! @paginate( defaultCount: 25 @@ -26,6 +30,23 @@ type People { builder: "App\\GraphQL\\Social\\Queries\\Tags\\TagsQueries@getTagsBuilder" ) } +type PeopleEmploymentHistory { + id: ID! + people: People! @belongsTo + position: String! + income: Float + start_date: Date! + end_date: Date + status: Int! + income_type: String + company_employer_name: String! + company_employer_phone: String + company_employer_address: String + company_employer_email: String + company_employer_city: String + company_employer_state: String + company_employer_zip: String +} type PeopleRelationship { id: ID! diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index 91ca58a2c7..1e325dd0ad 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -10,6 +10,7 @@ use Kanvas\Guild\Customers\Models\Contact; use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Customers\Repositories\PeoplesRepository; +use Kanvas\Workflow\Enums\WorkflowEnum; class CreatePeopleAction { @@ -113,6 +114,13 @@ public function execute(): People } } + $people->fireWorkflow( + WorkflowEnum::CREATED->value, + true, + [ + ] + ); + return $people; } } diff --git a/src/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Guild/Customers/Actions/ScreeningAction.php index 260a4cae30..7df2515786 100644 --- a/src/Domains/Guild/Customers/Actions/ScreeningAction.php +++ b/src/Domains/Guild/Customers/Actions/ScreeningAction.php @@ -5,35 +5,41 @@ namespace Kanvas\Guild\Customers\Actions; use GuzzleHttp\Exception\GuzzleException; -use Kanvas\Apps\Models\App; +use Kanvas\Apps\Models\Apps; use Kanvas\Guild\Customers\Models\People; +use Kanvas\Guild\Customers\Models\ContactType; +use GuzzleHttp\Client; class ScreeningAction { public function __construct( protected People $people, - protected App $app + protected Apps $app ) { } public function execute(): array { - $email = $this->people->getEmails(); + $client = new Client(); + $email = $this->people->getEmails()->first(); + $linkedin = $this->people->contacts() + ->where('contacts_types_id', ContactType::getByName('LinkedIn')->getId()) + ->first(); $data = [ 'first_name' => $this->people->firstname, 'last_name' => $this->people->lastname, 'name' => $this->people->getName(), 'email' => $email ? $email->value : null, - 'reveal_personal_email' => true, - 'reveal_phone_number' => true, + 'linkedin_url' => $linkedin ? $linkedin->value : null, ]; + dump($this->app->get('apollo_api_key')); try { // Envía la solicitud POST a la API de Apollo.io $response = $client->post('https://api.apollo.io/v1/people/match', [ 'headers' => [ 'Content-Type' => 'application/json', 'Cache-Control' => 'no-cache', - 'X-Api-Key' => $apiKey, + 'X-Api-Key' => $this->app->get('apollo-api-key'), ], 'json' => $data, ]); diff --git a/src/Domains/Guild/Customers/Models/People.php b/src/Domains/Guild/Customers/Models/People.php index 23465f8c06..f447b0baf6 100644 --- a/src/Domains/Guild/Customers/Models/People.php +++ b/src/Domains/Guild/Customers/Models/People.php @@ -12,6 +12,7 @@ use Kanvas\Guild\Models\BaseModel; use Kanvas\Social\Tags\Traits\HasTagsTrait; use Laravel\Scout\Searchable; +use Kanvas\Workflow\Traits\CanUseWorkflow; /** * Class People. @@ -38,6 +39,7 @@ class People extends BaseModel use UuidTrait; use Searchable; use HasTagsTrait; + use CanUseWorkflow; protected $table = 'peoples'; protected $guarded = []; diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php index a527250854..d74f45f496 100644 --- a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -4,20 +4,44 @@ namespace Kanvas\Guild\Customers\Models; use Kanvas\Guild\Models\BaseModel; - +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * Class PeopleEmploymentHistory * * @property int $id * @property int $peoples_id - * @property string $company_name + * @property string $apps_id * @property string $position + * @property null|float $income * @property string $start_date - * @property string $end_date - * @property string $description + * @property null|string $end_date + * @property int status + * @property null|string $income_type + * @property string $company_employer_name + * @property null|string $company_employer_phone + * @property null|string $company_employer_address + * @property null|string $company_employer_phone + * @property null|string $company_employer_email + * @property null|string $company_employer_city + * @property null|string $company_employer_state + * @property null|string $company_employer_zip */ class PeopleEmploymentHistory extends BaseModel { protected $table = 'peoples_employment_history'; protected $guarded = []; + + public function user(): BelongsTo + { + return $this->belongsTo(User::class, 'foreign_key', 'other_key'); + } + + public function people() + { + return $this->belongsTo( + People::class, + 'peoples_id', + 'id' + ); + } } \ No newline at end of file diff --git a/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php index afde591a2e..48e1d952c6 100644 --- a/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php @@ -4,44 +4,47 @@ namespace Kanvas\Guild\Customers\Workflows\Activities; +use Baka\Contracts\AppInterface; use Illuminate\Database\Eloquent\Model; -use Workflow\Activity; -use Kanvas\Apps\Models\Apps; use Kanvas\Guild\Customers\Actions\ScreeningAction; -use Kanvas\Guild\Customers\Models\ContactType; +use Kanvas\Guild\Customers\Models\Address; use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; -use Kanvas\Enums\AppEnums; +use Kanvas\Locations\Models\Countries; +use Workflow\Activity; class ScreeningPeopleActivity extends Activity { - public $tries = 5; + public $tries = 1; - public function execute(Model $people, array $params): array + public function execute(Model $people, AppInterface $app, array $params): array { - $peopleData = (new ScreeningAction($people, app(Apps::class)))->execute(); - $contactType = ContactType::firstOrCreate([ - 'name' => 'LinkedIn', - 'users_id' => AppEnums::DEFAULT_USER_ID, - 'companies_id' => AppEnums::DEFAULT_COMPANY_ID - ]); - $people->contacts()->create([ - 'contacts_types_id' => $contactType->id, - 'value' => $peopleData['linkedin'], - 'weight' => 1 - ]); + $peopleData = (new ScreeningAction($people, $app))->execute(); $history = []; - foreach($peopleData['employment_history'] as $employmentHistory) { - $history[] = PeopleEmploymentHistory::create([ - 'peoples_id' => $people->id, + foreach ($peopleData['employment_history'] as $employmentHistory) { + $history[] = new PeopleEmploymentHistory([ + 'status' => (int)$employmentHistory['current'], 'company_employer_name' => $employmentHistory['organization_name'], - 'position' => $employmentHistory['position'], 'start_date' => $employmentHistory['start_date'], 'end_date' => $employmentHistory['end_date'], 'position' => $employmentHistory['title'], - 'address' => $employmentHistory['raw_address'], + 'company_employer_address' => $employmentHistory['raw_address'], ]); } + $country = Countries::where('name', $peopleData['country'])->first(); + $address = new Address([ + 'address' => ' ', + 'address_2' => ' ', + 'city' => $peopleData['city'], + 'state' => $peopleData['state'], + 'county' => '', + 'zip' => ' ', + 'city_id' => 0, + 'state_id' => 0, + 'countries_id' => $country->getId(), + ]); $people->peoplesEmploymentHistory()->saveMany($history); + $people->address()->saveMany([$address]); + return [ 'status' => 'success', 'message' => 'People screened successfully', From e49b136cc8358ea6f148ff36cd8a5b555e68b26a Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 13 Jun 2024 15:54:26 -0400 Subject: [PATCH 03/58] remove dump --- src/Domains/Guild/Customers/Actions/ScreeningAction.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Guild/Customers/Actions/ScreeningAction.php index 7df2515786..55cf68187c 100644 --- a/src/Domains/Guild/Customers/Actions/ScreeningAction.php +++ b/src/Domains/Guild/Customers/Actions/ScreeningAction.php @@ -32,7 +32,6 @@ public function execute(): array 'email' => $email ? $email->value : null, 'linkedin_url' => $linkedin ? $linkedin->value : null, ]; - dump($this->app->get('apollo_api_key')); try { // Envía la solicitud POST a la API de Apollo.io $response = $client->post('https://api.apollo.io/v1/people/match', [ From 68e48a2d86c9780e0fd55876a4a25af6948e6347 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Thu, 13 Jun 2024 16:04:04 -0400 Subject: [PATCH 04/58] refactor: new exception --- src/Domains/Guild/Customers/Actions/ScreeningAction.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Guild/Customers/Actions/ScreeningAction.php index 55cf68187c..d9324599c9 100644 --- a/src/Domains/Guild/Customers/Actions/ScreeningAction.php +++ b/src/Domains/Guild/Customers/Actions/ScreeningAction.php @@ -9,6 +9,7 @@ use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Customers\Models\ContactType; use GuzzleHttp\Client; +use Exception; class ScreeningAction { @@ -46,7 +47,7 @@ public function execute(): array return json_decode($response->getBody()->getContents(), true)["person"]; } catch (GuzzleException $e) { - echo 'Error de Guzzle: ' . $e->getMessage(); + throw new Exception($e->getMessage()); } } From 2c04b9f44222fc5c7464c40b5691ef74e9ce1324 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Thu, 13 Jun 2024 20:04:36 +0000 Subject: [PATCH 05/58] Apply fixes from StyleCI --- .../Guild/2024_06_11_215748_peoples_employment_history.php | 3 +-- src/Domains/Guild/Customers/Actions/ScreeningAction.php | 4 +--- .../Guild/Customers/Models/PeopleEmploymentHistory.php | 6 ++++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index 9bf44720e8..20543a7fef 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.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/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Guild/Customers/Actions/ScreeningAction.php index d9324599c9..31fb2431bd 100644 --- a/src/Domains/Guild/Customers/Actions/ScreeningAction.php +++ b/src/Domains/Guild/Customers/Actions/ScreeningAction.php @@ -24,7 +24,7 @@ public function execute(): array $client = new Client(); $email = $this->people->getEmails()->first(); $linkedin = $this->people->contacts() - ->where('contacts_types_id', ContactType::getByName('LinkedIn')->getId()) + ->where('contacts_types_id', ContactType::getByName('LinkedIn')->getId()) ->first(); $data = [ 'first_name' => $this->people->firstname, @@ -45,10 +45,8 @@ public function execute(): array ]); return json_decode($response->getBody()->getContents(), true)["person"]; - } catch (GuzzleException $e) { throw new Exception($e->getMessage()); } - } } diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php index d74f45f496..381da8a117 100644 --- a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -1,10 +1,12 @@ Date: Thu, 13 Jun 2024 23:17:02 -0400 Subject: [PATCH 06/58] refactor: fix relationship --- .../Customers/Models/PeopleEmploymentHistory.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php index d74f45f496..82b54f48dd 100644 --- a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -1,10 +1,12 @@ belongsTo(User::class, 'foreign_key', 'other_key'); - } - - public function people() + public function people(): BelongsTo { return $this->belongsTo( People::class, @@ -44,4 +41,4 @@ public function people() 'id' ); } -} \ No newline at end of file +} From 1b2ece7585d3fcd8ad0859d0a655cd2075223642 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 14 Jun 2024 11:29:09 -0400 Subject: [PATCH 07/58] refactor: move to domain apollo and change column name --- ...4_06_11_215748_peoples_employment_history.php | 14 +++++++------- graphql/schemas/Guild/people.graphql | 14 +++++++------- .../Apollo}/Actions/ScreeningAction.php | 11 ++++++----- .../Activities/ScreeningPeopleActivity.php | 8 ++++---- .../Customers/Models/PeopleEmploymentHistory.php | 16 ++++++++-------- 5 files changed, 32 insertions(+), 31 deletions(-) rename src/Domains/{Guild/Customers => Connectors/Apollo}/Actions/ScreeningAction.php (95%) rename src/Domains/{Guild/Customers => Connectors/Apollo}/Workflows/Activities/ScreeningPeopleActivity.php (85%) diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index 20543a7fef..19bd9dffd8 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -20,13 +20,13 @@ public function up(): void $table->date('end_date')->nullable(); $table->integer('status')->default(0); $table->string('income_type')->nullable(); - $table->string('company_employer_name'); - $table->string('company_employer_address')->nullable(); - $table->string('company_employer_phone')->nullable(); - $table->string('company_employer_email')->nullable(); - $table->string('company_employer_city')->nullable(); - $table->string('company_employer_state')->nullable(); - $table->string('company_employer_zip')->nullable(); + $table->string('company_name'); + $table->string('company_address')->nullable(); + $table->string('company_phone')->nullable(); + $table->string('company_email')->nullable(); + $table->string('company_city')->nullable(); + $table->string('company_state')->nullable(); + $table->string('company_zip')->nullable(); $table->boolean('is_deleted')->default(0); $table->dateTime('created_at')->index('created_at'); $table->dateTime('updated_at')->nullable()->index('updated_at'); diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index cf6889b93a..262e7486e9 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -39,13 +39,13 @@ type PeopleEmploymentHistory { end_date: Date status: Int! income_type: String - company_employer_name: String! - company_employer_phone: String - company_employer_address: String - company_employer_email: String - company_employer_city: String - company_employer_state: String - company_employer_zip: String + company_name: String! + company_phone: String + company_address: String + company_email: String + company_city: String + company_state: String + company_zip: String } type PeopleRelationship { diff --git a/src/Domains/Guild/Customers/Actions/ScreeningAction.php b/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php similarity index 95% rename from src/Domains/Guild/Customers/Actions/ScreeningAction.php rename to src/Domains/Connectors/Apollo/Actions/ScreeningAction.php index 31fb2431bd..cd99e80dd0 100644 --- a/src/Domains/Guild/Customers/Actions/ScreeningAction.php +++ b/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Kanvas\Guild\Customers\Actions; +namespace Kanvas\Connectors\Apollo\Actions; +use Exception; +use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Kanvas\Apps\Models\Apps; -use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Customers\Models\ContactType; -use GuzzleHttp\Client; -use Exception; +use Kanvas\Guild\Customers\Models\People; class ScreeningAction { @@ -33,6 +33,7 @@ public function execute(): array 'email' => $email ? $email->value : null, 'linkedin_url' => $linkedin ? $linkedin->value : null, ]; + try { // Envía la solicitud POST a la API de Apollo.io $response = $client->post('https://api.apollo.io/v1/people/match', [ @@ -44,7 +45,7 @@ public function execute(): array 'json' => $data, ]); - return json_decode($response->getBody()->getContents(), true)["person"]; + return json_decode($response->getBody()->getContents(), true)['person']; } catch (GuzzleException $e) { throw new Exception($e->getMessage()); } diff --git a/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php similarity index 85% rename from src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php rename to src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index 48e1d952c6..38e5716504 100644 --- a/src/Domains/Guild/Customers/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Kanvas\Guild\Customers\Workflows\Activities; +namespace Kanvas\Connectors\Apollo\Workflows\Activities; use Baka\Contracts\AppInterface; use Illuminate\Database\Eloquent\Model; -use Kanvas\Guild\Customers\Actions\ScreeningAction; +use Kanvas\Connectors\Apollo\Actions\ScreeningAction; use Kanvas\Guild\Customers\Models\Address; use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; use Kanvas\Locations\Models\Countries; @@ -23,11 +23,11 @@ public function execute(Model $people, AppInterface $app, array $params): array foreach ($peopleData['employment_history'] as $employmentHistory) { $history[] = new PeopleEmploymentHistory([ 'status' => (int)$employmentHistory['current'], - 'company_employer_name' => $employmentHistory['organization_name'], + 'company_name' => $employmentHistory['organization_name'], 'start_date' => $employmentHistory['start_date'], 'end_date' => $employmentHistory['end_date'], 'position' => $employmentHistory['title'], - 'company_employer_address' => $employmentHistory['raw_address'], + 'company_address' => $employmentHistory['raw_address'], ]); } $country = Countries::where('name', $peopleData['country'])->first(); diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php index 82b54f48dd..3fc09618e9 100644 --- a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -19,14 +19,14 @@ * @property null|string $end_date * @property int status * @property null|string $income_type - * @property string $company_employer_name - * @property null|string $company_employer_phone - * @property null|string $company_employer_address - * @property null|string $company_employer_phone - * @property null|string $company_employer_email - * @property null|string $company_employer_city - * @property null|string $company_employer_state - * @property null|string $company_employer_zip + * @property string $company_name + * @property null|string $company_phone + * @property null|string $company_address + * @property null|string $company_phone + * @property null|string $company_email + * @property null|string $company_city + * @property null|string $company_state + * @property null|string $company_zip */ class PeopleEmploymentHistory extends BaseModel { From c928f2542b8f3cb640e8dabab5011eb39156437b Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 14 Jun 2024 15:36:16 -0400 Subject: [PATCH 08/58] refactor: send app --- graphql/schemas/Guild/people.graphql | 2 +- src/Domains/Guild/Customers/Actions/CreatePeopleAction.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 262e7486e9..7758d900b7 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -10,7 +10,7 @@ type People { dob: Date contacts: [Contact!]! @hasMany address: [Address!]! @hasMany - peoplesEmploymentHistory: [PeopleEmploymentHistory!]! + peoples_employmentHistory: [PeopleEmploymentHistory!]! @hasMany( relation: "peoplesEmploymentHistory" ) diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index 1e325dd0ad..f930ef4131 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -118,6 +118,7 @@ public function execute(): People WorkflowEnum::CREATED->value, true, [ + 'app' => $this->peopleData->app, ] ); From 4252c51aa454002598d72a05d3e5e519cacfb2e7 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Fri, 14 Jun 2024 16:19:08 -0400 Subject: [PATCH 09/58] refactor: delete relationship before update --- .../Apollo/Workflows/Activities/ScreeningPeopleActivity.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index 38e5716504..e440a8098d 100644 --- a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -42,6 +42,10 @@ public function execute(Model $people, AppInterface $app, array $params): array 'state_id' => 0, 'countries_id' => $country->getId(), ]); + + $people->peoplesEmploymentHistory()->delete(); + $people->address()->delete(); + $people->peoplesEmploymentHistory()->saveMany($history); $people->address()->saveMany([$address]); From 60d97b6eeb38292fc8d036aeafee76796b7269e0 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Sat, 15 Jun 2024 22:28:55 -0400 Subject: [PATCH 10/58] refactor: add index --- .../2024_06_11_215748_peoples_employment_history.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index 19bd9dffd8..a46f85b33d 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -12,13 +12,13 @@ public function up(): void { Schema::create('peoples_employment_history', function (Blueprint $table) { $table->id(); - $table->integer('peoples_id')->unsigned(); - $table->integer('apps_id')->unsigned(); + $table->integer('peoples_id')->unsigned()->index('peoples_id'); + $table->integer('apps_id')->unsigned()->index('apps_id'); $table->string('position'); $table->decimal('income', 10, 2)->nullable(); - $table->date('start_date'); - $table->date('end_date')->nullable(); - $table->integer('status')->default(0); + $table->date('start_date')->index(); + $table->date('end_date')->nullable()->index(); + $table->integer('status')->default(0)->index(); $table->string('income_type')->nullable(); $table->string('company_name'); $table->string('company_address')->nullable(); From 4542f96f97c2cd041d37a2c2ac1916e16b0c0d46 Mon Sep 17 00:00:00 2001 From: FredPeal Date: Sun, 16 Jun 2024 13:54:38 -0400 Subject: [PATCH 11/58] refactor: upload feedback --- graphql/schemas/Guild/people.graphql | 4 ++-- .../Workflows/Activities/ScreeningPeopleActivity.php | 12 ++++-------- src/Domains/Guild/Customers/Models/People.php | 5 ++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 7758d900b7..79c9f6dd80 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -10,9 +10,9 @@ type People { dob: Date contacts: [Contact!]! @hasMany address: [Address!]! @hasMany - peoples_employmentHistory: [PeopleEmploymentHistory!]! + employment_history: [PeopleEmploymentHistory!] @hasMany( - relation: "peoplesEmploymentHistory" + relation: "employmentHistory" ) files: [Filesystem!]! @paginate( diff --git a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index e440a8098d..f8ea91658a 100644 --- a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -21,17 +21,19 @@ public function execute(Model $people, AppInterface $app, array $params): array $peopleData = (new ScreeningAction($people, $app))->execute(); $history = []; foreach ($peopleData['employment_history'] as $employmentHistory) { - $history[] = new PeopleEmploymentHistory([ + PeopleEmploymentHistory::firstOrCreate([ 'status' => (int)$employmentHistory['current'], 'company_name' => $employmentHistory['organization_name'], 'start_date' => $employmentHistory['start_date'], 'end_date' => $employmentHistory['end_date'], 'position' => $employmentHistory['title'], 'company_address' => $employmentHistory['raw_address'], + 'peoples_id' => $people->id, ]); } $country = Countries::where('name', $peopleData['country'])->first(); - $address = new Address([ + $address = Address::firstOrCreate([ + 'peoples_id' => $people->id, 'address' => ' ', 'address_2' => ' ', 'city' => $peopleData['city'], @@ -43,12 +45,6 @@ public function execute(Model $people, AppInterface $app, array $params): array 'countries_id' => $country->getId(), ]); - $people->peoplesEmploymentHistory()->delete(); - $people->address()->delete(); - - $people->peoplesEmploymentHistory()->saveMany($history); - $people->address()->saveMany([$address]); - return [ 'status' => 'success', 'message' => 'People screened successfully', diff --git a/src/Domains/Guild/Customers/Models/People.php b/src/Domains/Guild/Customers/Models/People.php index f447b0baf6..c7ac7e8926 100644 --- a/src/Domains/Guild/Customers/Models/People.php +++ b/src/Domains/Guild/Customers/Models/People.php @@ -4,15 +4,14 @@ namespace Kanvas\Guild\Customers\Models; -use Baka\Traits\NoAppRelationshipTrait; use Baka\Traits\UuidTrait; use Illuminate\Database\Eloquent\Collection; 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; use Kanvas\Workflow\Traits\CanUseWorkflow; +use Laravel\Scout\Searchable; /** * Class People. @@ -78,7 +77,7 @@ public function emails(): HasMany ); } - public function peoplesEmploymentHistory(): HasMany + public function employmentHistory(): HasMany { return $this->hasMany( PeopleEmploymentHistory::class, From 9afbee664633940681cb6e8e0adb9d9eac4f6575 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Mon, 17 Jun 2024 12:18:46 -0400 Subject: [PATCH 12/58] add deploy to ec2 on prod --- .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 2017d8bd15..92ff90592c 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -3,6 +3,7 @@ name: Deploy to EC2 on: push: branches: + - '1.x' - 'development' workflow_dispatch: From c4289fdf0d3b59caf95544282e6b545d6bc21043 Mon Sep 17 00:00:00 2001 From: Rafael White Date: Mon, 17 Jun 2024 12:21:51 -0400 Subject: [PATCH 13/58] add production docker compose. Deploy docker compose file dynamically --- .github/workflows/ec2-deploy.yaml | 2 +- ...-compose.dev.yml => docker-compose.1.x.yml | 0 docker-compose.development.yml | 132 ++++++++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) rename docker-compose.dev.yml => docker-compose.1.x.yml (100%) create mode 100644 docker-compose.development.yml diff --git a/.github/workflows/ec2-deploy.yaml b/.github/workflows/ec2-deploy.yaml index 92ff90592c..1992be366c 100644 --- a/.github/workflows/ec2-deploy.yaml +++ b/.github/workflows/ec2-deploy.yaml @@ -40,7 +40,7 @@ jobs: key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} script: | cd ${{secrets.AWS_EC2_TARGET_DIR}} - docker compose -f docker-compose.dev.yml up -d + docker compose -f docker-compose.${{ github.ref_name }}.yml up -d docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache docker exec -i phpkanvas-ecosystem php artisan config:cache docker restart queue diff --git a/docker-compose.dev.yml b/docker-compose.1.x.yml similarity index 100% rename from docker-compose.dev.yml rename to docker-compose.1.x.yml diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 0000000000..6d37afdbba --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,132 @@ +services: + php: + container_name: php${APP_CONTAINER_NAME} + build: + context: . + dockerfile: development.Dockerfile + extra_hosts: + - 'host.docker.internal:host-gateway' + 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"] + 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"] + 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"] + 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 + 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} + 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 af7fc0c161c4897c5ea977eb7adaed57150177af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:16:29 +0000 Subject: [PATCH 14/58] build(deps-dev): bump phpstan/phpstan from 1.11.4 to 1.11.5 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.4 to 1.11.5. - [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.4...1.11.5) --- 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 10b2aae9de..fe7d1f0c4e 100644 --- a/composer.lock +++ b/composer.lock @@ -14142,16 +14142,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.4", + "version": "1.11.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", "shasum": "" }, "require": { @@ -14196,7 +14196,7 @@ "type": "github" } ], - "time": "2024-06-06T12:19:22+00:00" + "time": "2024-06-17T15:10:54+00:00" }, { "name": "phpunit/php-code-coverage", From 8aad514438b75080de22b8e161963c9cdb5ea4d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:16:51 +0000 Subject: [PATCH 15/58] build(deps): bump nuwave/lighthouse from 6.37.0 to 6.37.1 Bumps [nuwave/lighthouse](https://github.com/nuwave/lighthouse) from 6.37.0 to 6.37.1. - [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.37.0...v6.37.1) --- updated-dependencies: - dependency-name: nuwave/lighthouse dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 10b2aae9de..efe1eff01f 100644 --- a/composer.lock +++ b/composer.lock @@ -6381,16 +6381,16 @@ }, { "name": "nuwave/lighthouse", - "version": "v6.37.0", + "version": "v6.37.1", "source": { "type": "git", "url": "https://github.com/nuwave/lighthouse.git", - "reference": "7f9a6d844ab8ce83f50805973a6bb066e449f953" + "reference": "ea496a2a6fc31e10a08689105c58a77418b85426" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/7f9a6d844ab8ce83f50805973a6bb066e449f953", - "reference": "7f9a6d844ab8ce83f50805973a6bb066e449f953", + "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/ea496a2a6fc31e10a08689105c58a77418b85426", + "reference": "ea496a2a6fc31e10a08689105c58a77418b85426", "shasum": "" }, "require": { @@ -6511,7 +6511,7 @@ "type": "patreon" } ], - "time": "2024-06-11T09:58:58+00:00" + "time": "2024-06-17T08:59:30+00:00" }, { "name": "nyholm/psr7", @@ -13446,16 +13446,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.12.2", + "version": "v15.12.3", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f" + "reference": "7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f", - "reference": "21bc031e4b0c2035e4d4ddb88ffef98e2f11c97f", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9", + "reference": "7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9", "shasum": "" }, "require": { @@ -13468,7 +13468,7 @@ "amphp/http-server": "^2.1", "dms/phpunit-arraysubset-asserts": "dev-master", "ergebnis/composer-normalize": "^2.28", - "friendsofphp/php-cs-fixer": "3.58.1", + "friendsofphp/php-cs-fixer": "3.59.3", "mll-lab/php-cs-fixer-config": "^5", "nyholm/psr7": "^1.5", "phpbench/phpbench": "^1.2", @@ -13476,7 +13476,7 @@ "phpstan/phpstan": "1.11.4", "phpstan/phpstan-phpunit": "1.4.0", "phpstan/phpstan-strict-rules": "1.6.0", - "phpunit/phpunit": "^9.5 || ^10", + "phpunit/phpunit": "^9.5 || ^10.5.21", "psr/http-message": "^1 || ^2", "react/http": "^1.6", "react/promise": "^2.0 || ^3.0", @@ -13508,7 +13508,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.12.2" + "source": "https://github.com/webonyx/graphql-php/tree/v15.12.3" }, "funding": [ { @@ -13516,7 +13516,7 @@ "type": "open_collective" } ], - "time": "2024-06-13T07:28:14+00:00" + "time": "2024-06-17T09:32:30+00:00" } ], "packages-dev": [ From a7c29c0e4a15874c4077d79eb31d8b8caa732388 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:59:27 +0000 Subject: [PATCH 16/58] build(deps): bump docker/build-push-action from 5 to 6 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v5...v6) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/deploy-gcp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gcp.yml b/.github/workflows/deploy-gcp.yml index 58b535aea3..396b203f44 100644 --- a/.github/workflows/deploy-gcp.yml +++ b/.github/workflows/deploy-gcp.yml @@ -38,7 +38,7 @@ jobs: - id: docker-push-tagged name: Tag Docker image and push to Google Artifact Registry - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: push: true file: ${{ github.ref_name }}.Dockerfile From 6d11080d41fe1201f678cbc23288ec8e332940ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:22:16 +0000 Subject: [PATCH 17/58] build(deps): bump sentry/sentry-laravel from 4.6.0 to 4.6.1 Bumps [sentry/sentry-laravel](https://github.com/getsentry/sentry-laravel) from 4.6.0 to 4.6.1. - [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.6.0...4.6.1) --- updated-dependencies: - dependency-name: sentry/sentry-laravel dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index e0b6215ba4..b928b36b3b 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.10.0", + "version": "v11.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99b4255194912044b75ab72329f8c19e6345720e" + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99b4255194912044b75ab72329f8c19e6345720e", - "reference": "99b4255194912044b75ab72329f8c19e6345720e", + "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa", + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa", "shasum": "" }, "require": { @@ -4018,7 +4018,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.0.15", + "orchestra/testbench-core": "^9.1.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.5|^11.0", @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-04T13:45:55+00:00" + "time": "2024-06-18T17:40:27+00:00" }, { "name": "laravel/octane", @@ -4200,16 +4200,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/sanctum", @@ -8667,16 +8667,16 @@ }, { "name": "sentry/sentry-laravel", - "version": "4.6.0", + "version": "4.6.1", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "75c11944211ce7707bb92e717c5bda93a1759438" + "reference": "7f5fd9f362e440c4c0c492f386b93095321f9101" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/75c11944211ce7707bb92e717c5bda93a1759438", - "reference": "75c11944211ce7707bb92e717c5bda93a1759438", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/7f5fd9f362e440c4c0c492f386b93095321f9101", + "reference": "7f5fd9f362e440c4c0c492f386b93095321f9101", "shasum": "" }, "require": { @@ -8740,7 +8740,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/4.6.0" + "source": "https://github.com/getsentry/sentry-laravel/tree/4.6.1" }, "funding": [ { @@ -8752,7 +8752,7 @@ "type": "custom" } ], - "time": "2024-06-11T12:23:24+00:00" + "time": "2024-06-18T15:06:09+00:00" }, { "name": "shopify/shopify-api", From 558b3d0f12efb0b6f6c8d25e6195a675c793a557 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:22:28 +0000 Subject: [PATCH 18/58] build(deps): bump laravel/socialite from 5.14.0 to 5.15.0 Bumps [laravel/socialite](https://github.com/laravel/socialite) from 5.14.0 to 5.15.0. - [Release notes](https://github.com/laravel/socialite/releases) - [Changelog](https://github.com/laravel/socialite/blob/5.x/CHANGELOG.md) - [Commits](https://github.com/laravel/socialite/compare/v5.14.0...v5.15.0) --- updated-dependencies: - dependency-name: laravel/socialite dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index e0b6215ba4..38f55bc913 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.10.0", + "version": "v11.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99b4255194912044b75ab72329f8c19e6345720e" + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99b4255194912044b75ab72329f8c19e6345720e", - "reference": "99b4255194912044b75ab72329f8c19e6345720e", + "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa", + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa", "shasum": "" }, "require": { @@ -4018,7 +4018,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.0.15", + "orchestra/testbench-core": "^9.1.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.5|^11.0", @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-04T13:45:55+00:00" + "time": "2024-06-18T17:40:27+00:00" }, { "name": "laravel/octane", @@ -4200,16 +4200,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/sanctum", @@ -4460,16 +4460,16 @@ }, { "name": "laravel/socialite", - "version": "v5.14.0", + "version": "v5.15.0", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a" + "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/c7b0193a3753a29aff8ce80aa2f511917e6ed68a", - "reference": "c7b0193a3753a29aff8ce80aa2f511917e6ed68a", + "url": "https://api.github.com/repos/laravel/socialite/zipball/c8234bfb286a8210df8d62f94562c71bfda4a446", + "reference": "c8234bfb286a8210df8d62f94562c71bfda4a446", "shasum": "" }, "require": { @@ -4528,7 +4528,7 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2024-05-03T20:31:38+00:00" + "time": "2024-06-11T13:33:20+00:00" }, { "name": "laravel/tinker", @@ -6593,24 +6593,24 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v2.7.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105" + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/52a0d99e69f56b9ec27ace92ba56897fe6993105", - "reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", + "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", "shasum": "" }, "require": { - "php": "^7|^8" + "php": "^8" }, "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" + "phpunit/phpunit": "^9", + "vimeo/psalm": "^4|^5" }, "type": "library", "autoload": { @@ -6656,7 +6656,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2024-05-08T12:18:48+00:00" + "time": "2024-05-08T12:36:18+00:00" }, { "name": "paragonie/random_compat", @@ -7354,20 +7354,20 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.37", + "version": "3.0.38", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8" + "reference": "b18b8788e51156c4dd97b7f220a31149a0052067" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8", - "reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b18b8788e51156c4dd97b7f220a31149a0052067", + "reference": "b18b8788e51156c4dd97b7f220a31149a0052067", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^1|^2", + "paragonie/constant_time_encoding": "^1|^2|^3", "paragonie/random_compat": "^1.4|^2.0|^9.99.99", "php": ">=5.6.1" }, @@ -7444,7 +7444,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.37" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.38" }, "funding": [ { @@ -7460,7 +7460,7 @@ "type": "tidelift" } ], - "time": "2024-03-03T02:14:58+00:00" + "time": "2024-06-17T10:11:32+00:00" }, { "name": "phpstan/phpdoc-parser", From 94921e9ca1070109961782ff48bbb8561412b2b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:22:38 +0000 Subject: [PATCH 19/58] build(deps): bump laravel/scout from 10.9.0 to 10.10.0 Bumps [laravel/scout](https://github.com/laravel/scout) from 10.9.0 to 10.10.0. - [Release notes](https://github.com/laravel/scout/releases) - [Changelog](https://github.com/laravel/scout/blob/10.x/CHANGELOG.md) - [Commits](https://github.com/laravel/scout/compare/v10.9.0...v10.10.0) --- updated-dependencies: - dependency-name: laravel/scout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index e0b6215ba4..470b7010c5 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.10.0", + "version": "v11.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99b4255194912044b75ab72329f8c19e6345720e" + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99b4255194912044b75ab72329f8c19e6345720e", - "reference": "99b4255194912044b75ab72329f8c19e6345720e", + "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa", + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa", "shasum": "" }, "require": { @@ -4018,7 +4018,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.0.15", + "orchestra/testbench-core": "^9.1.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.5|^11.0", @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-04T13:45:55+00:00" + "time": "2024-06-18T17:40:27+00:00" }, { "name": "laravel/octane", @@ -4200,16 +4200,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/sanctum", @@ -4322,16 +4322,16 @@ }, { "name": "laravel/scout", - "version": "v10.9.0", + "version": "v10.10.0", "source": { "type": "git", "url": "https://github.com/laravel/scout.git", - "reference": "7bac13a61f1670b4314a65a13b8b12c6575270c8" + "reference": "68767821bb5fd18b823ab136f334cfd865b16433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/scout/zipball/7bac13a61f1670b4314a65a13b8b12c6575270c8", - "reference": "7bac13a61f1670b4314a65a13b8b12c6575270c8", + "url": "https://api.github.com/repos/laravel/scout/zipball/68767821bb5fd18b823ab136f334cfd865b16433", + "reference": "68767821bb5fd18b823ab136f334cfd865b16433", "shasum": "" }, "require": { @@ -4396,7 +4396,7 @@ "issues": "https://github.com/laravel/scout/issues", "source": "https://github.com/laravel/scout" }, - "time": "2024-05-07T14:16:56+00:00" + "time": "2024-06-18T16:54:44+00:00" }, { "name": "laravel/serializable-closure", From 02388aa553edb9add3ebc6dbaf9f9251c57fb379 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 22:22:52 +0000 Subject: [PATCH 20/58] build(deps): bump laravel/framework from 11.10.0 to 11.11.0 Bumps [laravel/framework](https://github.com/laravel/framework) from 11.10.0 to 11.11.0. - [Release notes](https://github.com/laravel/framework/releases) - [Changelog](https://github.com/laravel/framework/blob/11.x/CHANGELOG.md) - [Commits](https://github.com/laravel/framework/compare/v11.10.0...v11.11.0) --- updated-dependencies: - dependency-name: laravel/framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index e0b6215ba4..b5ea49b61e 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.10.0", + "version": "v11.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99b4255194912044b75ab72329f8c19e6345720e" + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99b4255194912044b75ab72329f8c19e6345720e", - "reference": "99b4255194912044b75ab72329f8c19e6345720e", + "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa", + "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa", "shasum": "" }, "require": { @@ -4018,7 +4018,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.0.15", + "orchestra/testbench-core": "^9.1.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.5|^11.0", @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-04T13:45:55+00:00" + "time": "2024-06-18T17:40:27+00:00" }, { "name": "laravel/octane", @@ -4200,16 +4200,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.23", + "version": "v0.1.24", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400" + "reference": "409b0b4305273472f3754826e68f4edbd0150149" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400", - "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400", + "url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", + "reference": "409b0b4305273472f3754826e68f4edbd0150149", "shasum": "" }, "require": { @@ -4252,9 +4252,9 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.23" + "source": "https://github.com/laravel/prompts/tree/v0.1.24" }, - "time": "2024-05-27T13:53:20+00:00" + "time": "2024-06-17T13:58:22+00:00" }, { "name": "laravel/sanctum", From addebbe77d9cb5965bf249a899ad9ff6c6ad71b5 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 10:39:56 -0400 Subject: [PATCH 21/58] refact: hotfix --- src/Domains/Guild/Leads/DataTransferObject/Lead.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Domains/Guild/Leads/DataTransferObject/Lead.php b/src/Domains/Guild/Leads/DataTransferObject/Lead.php index 5858a07695..f40379c334 100644 --- a/src/Domains/Guild/Leads/DataTransferObject/Lead.php +++ b/src/Domains/Guild/Leads/DataTransferObject/Lead.php @@ -6,7 +6,6 @@ use Baka\Contracts\AppInterface; use Baka\Users\Contracts\UserInterface; -use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\CompaniesBranches; use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Guild\Customers\DataTransferObject\Address; @@ -48,7 +47,7 @@ public function __construct( */ public static function viaRequest(UserInterface $user, AppInterface $app, array $request): self { - $branch = CompaniesBranches::getById($request['branch_id']); + $branch = isset($request['branch_id']) ? CompaniesBranches::getById($request['branch_id']) : $user->getCurrentCompany()->branch; CompaniesRepository::userAssociatedToCompanyAndBranch( $branch->company, $branch, From 57c3b79cf7dd211a927f69b99c4c35d8b462fe34 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 12:40:45 -0400 Subject: [PATCH 22/58] refact: people history --- app/Providers/EventServiceProvider.php | 3 +++ ...6_11_215748_peoples_employment_history.php | 16 +++++++++------- graphql/schemas/Guild/people.graphql | 9 ++------- .../Activities/ScreeningPeopleActivity.php | 16 ++++++++++++++-- src/Domains/Guild/Customers/Models/People.php | 12 ++++++++++++ .../Models/PeopleEmploymentHistory.php | 19 +++++++++++-------- .../Observers/PeopleEmploymentHistory.php | 16 ++++++++++++++++ .../Models/OrganizationPeople.php | 9 +++++++++ 8 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 8dc3fed641..23a8de51c8 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -9,6 +9,8 @@ use Kanvas\Companies\Models\Companies; use Kanvas\Companies\Models\CompaniesGroups; use Kanvas\Companies\Observers\CompaniesObserver; +use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; +use Kanvas\Guild\Customers\Observers\PeopleEmploymentHistory as ObserversPeopleEmploymentHistory; use Kanvas\Guild\Leads\Models\Lead; use Kanvas\Guild\Leads\Observers\LeadObserver; use Kanvas\Inventory\Categories\Observers\ProductsCategoriesObserver; @@ -81,6 +83,7 @@ public function boot() UsersAssociatedApps::observe(UsersAssociatedAppsObserver::class); UserCompanyApps::observe(UsersAssociatedCompaniesObserver::class); ProductsCategories::observe(ProductsCategoriesObserver::class); + PeopleEmploymentHistory::observe(ObserversPeopleEmploymentHistory::class); } /** diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index a46f85b33d..5c62bc94d0 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -12,6 +12,7 @@ public function up(): void { Schema::create('peoples_employment_history', function (Blueprint $table) { $table->id(); + $table->integer('organizations_id')->unsigned()->index('organizations_id'); $table->integer('peoples_id')->unsigned()->index('peoples_id'); $table->integer('apps_id')->unsigned()->index('apps_id'); $table->string('position'); @@ -20,17 +21,18 @@ public function up(): void $table->date('end_date')->nullable()->index(); $table->integer('status')->default(0)->index(); $table->string('income_type')->nullable(); - $table->string('company_name'); - $table->string('company_address')->nullable(); - $table->string('company_phone')->nullable(); - $table->string('company_email')->nullable(); - $table->string('company_city')->nullable(); - $table->string('company_state')->nullable(); - $table->string('company_zip')->nullable(); $table->boolean('is_deleted')->default(0); $table->dateTime('created_at')->index('created_at'); $table->dateTime('updated_at')->nullable()->index('updated_at'); }); + + //add to organizations email, city, state, zip + Schema::table('organizations', function (Blueprint $table) { + $table->string('email')->after('name')->index()->nullable(); + $table->string('city')->after('email')->nullable(); + $table->string('state')->after('city')->nullable(); + $table->string('zip')->after('state')->nullable(); + }); } /** diff --git a/graphql/schemas/Guild/people.graphql b/graphql/schemas/Guild/people.graphql index 79c9f6dd80..5c0f972ed4 100644 --- a/graphql/schemas/Guild/people.graphql +++ b/graphql/schemas/Guild/people.graphql @@ -8,6 +8,7 @@ type People { middlename: String lastname: String dob: Date + organizations: [Organization!] @belongsToMany contacts: [Contact!]! @hasMany address: [Address!]! @hasMany employment_history: [PeopleEmploymentHistory!] @@ -32,6 +33,7 @@ type People { } type PeopleEmploymentHistory { id: ID! + organization: Organization! @belongsTo people: People! @belongsTo position: String! income: Float @@ -39,13 +41,6 @@ type PeopleEmploymentHistory { end_date: Date status: Int! income_type: String - company_name: String! - company_phone: String - company_address: String - company_email: String - company_city: String - company_state: String - company_zip: String } type PeopleRelationship { diff --git a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index f8ea91658a..d3d2c93c77 100644 --- a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -9,6 +9,8 @@ use Kanvas\Connectors\Apollo\Actions\ScreeningAction; use Kanvas\Guild\Customers\Models\Address; use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; +use Kanvas\Guild\Organizations\Actions\CreateOrganizationAction; +use Kanvas\Guild\Organizations\DataTransferObject\Organization; use Kanvas\Locations\Models\Countries; use Workflow\Activity; @@ -19,16 +21,26 @@ class ScreeningPeopleActivity extends Activity public function execute(Model $people, AppInterface $app, array $params): array { $peopleData = (new ScreeningAction($people, $app))->execute(); + $history = []; foreach ($peopleData['employment_history'] as $employmentHistory) { + + $organization = new CreateOrganizationAction( + new Organization( + $people->company, + $people->user, + $employmentHistory['organization_name'], + $employmentHistory['raw_address'], + ) + ); + PeopleEmploymentHistory::firstOrCreate([ 'status' => (int)$employmentHistory['current'], - 'company_name' => $employmentHistory['organization_name'], 'start_date' => $employmentHistory['start_date'], 'end_date' => $employmentHistory['end_date'], 'position' => $employmentHistory['title'], - 'company_address' => $employmentHistory['raw_address'], 'peoples_id' => $people->id, + 'organizations_id' => $organization->execute()->getId(), ]); } $country = Countries::where('name', $peopleData['country'])->first(); diff --git a/src/Domains/Guild/Customers/Models/People.php b/src/Domains/Guild/Customers/Models/People.php index c7ac7e8926..225f60a787 100644 --- a/src/Domains/Guild/Customers/Models/People.php +++ b/src/Domains/Guild/Customers/Models/People.php @@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Kanvas\Guild\Customers\Factories\PeopleFactory; use Kanvas\Guild\Models\BaseModel; +use Kanvas\Guild\Organizations\Models\Organization; use Kanvas\Social\Tags\Traits\HasTagsTrait; use Kanvas\Workflow\Traits\CanUseWorkflow; use Laravel\Scout\Searchable; @@ -77,6 +78,17 @@ public function emails(): HasMany ); } + // Define the relationship with the Organization model + public function organizations() + { + return $this->belongsToMany( + Organization::class, + 'organizations_peoples', + 'peoples_id', + 'organizations_id' + ); + } + public function employmentHistory(): HasMany { return $this->hasMany( diff --git a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php index 3fc09618e9..e0982c1167 100644 --- a/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Models/PeopleEmploymentHistory.php @@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Kanvas\Guild\Models\BaseModel; +use Kanvas\Guild\Organizations\Models\Organization; /** * Class PeopleEmploymentHistory * * @property int $id + * @property int $organizations_id * @property int $peoples_id * @property string $apps_id * @property string $position @@ -19,14 +21,6 @@ * @property null|string $end_date * @property int status * @property null|string $income_type - * @property string $company_name - * @property null|string $company_phone - * @property null|string $company_address - * @property null|string $company_phone - * @property null|string $company_email - * @property null|string $company_city - * @property null|string $company_state - * @property null|string $company_zip */ class PeopleEmploymentHistory extends BaseModel { @@ -41,4 +35,13 @@ public function people(): BelongsTo 'id' ); } + + public function organization(): BelongsTo + { + return $this->belongsTo( + Organization::class, + 'organizations_id', + 'id' + ); + } } diff --git a/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php new file mode 100644 index 0000000000..f3703b799f --- /dev/null +++ b/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php @@ -0,0 +1,16 @@ +organization, $peopleHistory->people); + } +} diff --git a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php index 5dc7207f93..7e5f161817 100644 --- a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php +++ b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php @@ -44,4 +44,13 @@ public function scopeNotDeleted(Builder $query): Builder { return $query; } + + public static function addPeopleToOrganization(Organization $organization, People $people): OrganizationPeople + { + return self::firstOrCreate([ + 'organizations_id' => $organization->getId(), + 'peoples_id' => $people->getId(), + ]); + + } } From e32101cbb897d144d92c168f7d1b978f259b81ae Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 12:43:52 -0400 Subject: [PATCH 23/58] refact: fix issues --- .../Apollo/Workflows/Activities/ScreeningPeopleActivity.php | 1 - src/Domains/Guild/Organizations/Models/OrganizationPeople.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index d3d2c93c77..77cf2aec8f 100644 --- a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -24,7 +24,6 @@ public function execute(Model $people, AppInterface $app, array $params): array $history = []; foreach ($peopleData['employment_history'] as $employmentHistory) { - $organization = new CreateOrganizationAction( new Organization( $people->company, diff --git a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php index 7e5f161817..1dcf6bb129 100644 --- a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php +++ b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php @@ -51,6 +51,5 @@ public static function addPeopleToOrganization(Organization $organization, Peopl 'organizations_id' => $organization->getId(), 'peoples_id' => $people->getId(), ]); - } } From ab224319786febc38eb57de034d5260eb9cef3e4 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 13:43:20 -0400 Subject: [PATCH 24/58] refact: --- app/Providers/EventServiceProvider.php | 6 +-- ...6_11_215748_peoples_employment_history.php | 8 ++-- .../Apollo/Actions/ScreeningAction.php | 2 +- .../Activities/ScreeningPeopleActivity.php | 33 +++++++++-------- .../Workflows/ScreeningPeopleWorkflow.php | 20 ++++++++++ .../Guild/Customers/Models/ContactType.php | 14 ++++++- ...hp => PeopleEmploymentHistoryObserver.php} | 2 +- .../Models/OrganizationPeople.php | 2 + .../Apollo/PeopleScreeningTest.php | 37 +++++++++++++++++++ 9 files changed, 98 insertions(+), 26 deletions(-) create mode 100644 src/Domains/Connectors/Apollo/Workflows/ScreeningPeopleWorkflow.php rename src/Domains/Guild/Customers/Observers/{PeopleEmploymentHistory.php => PeopleEmploymentHistoryObserver.php} (91%) create mode 100644 tests/Connectors/Integration/Apollo/PeopleScreeningTest.php diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 23a8de51c8..8d4cd05c07 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -10,7 +10,7 @@ use Kanvas\Companies\Models\CompaniesGroups; use Kanvas\Companies\Observers\CompaniesObserver; use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; -use Kanvas\Guild\Customers\Observers\PeopleEmploymentHistory as ObserversPeopleEmploymentHistory; +use Kanvas\Guild\Customers\Observers\PeopleEmploymentHistoryObserver; use Kanvas\Guild\Leads\Models\Lead; use Kanvas\Guild\Leads\Observers\LeadObserver; use Kanvas\Inventory\Categories\Observers\ProductsCategoriesObserver; @@ -31,8 +31,6 @@ 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; @@ -83,7 +81,7 @@ public function boot() UsersAssociatedApps::observe(UsersAssociatedAppsObserver::class); UserCompanyApps::observe(UsersAssociatedCompaniesObserver::class); ProductsCategories::observe(ProductsCategoriesObserver::class); - PeopleEmploymentHistory::observe(ObserversPeopleEmploymentHistory::class); + PeopleEmploymentHistory::observe(PeopleEmploymentHistoryObserver::class); } /** diff --git a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php index 5c62bc94d0..6315307ac8 100644 --- a/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php +++ b/database/migrations/Guild/2024_06_11_215748_peoples_employment_history.php @@ -12,9 +12,9 @@ public function up(): void { Schema::create('peoples_employment_history', function (Blueprint $table) { $table->id(); - $table->integer('organizations_id')->unsigned()->index('organizations_id'); - $table->integer('peoples_id')->unsigned()->index('peoples_id'); - $table->integer('apps_id')->unsigned()->index('apps_id'); + $table->bigInteger('organizations_id')->unsigned()->index('organizations_id'); + $table->bigInteger('peoples_id')->unsigned()->index('peoples_id'); + $table->bigInteger('apps_id')->unsigned()->index('apps_id'); $table->string('position'); $table->decimal('income', 10, 2)->nullable(); $table->date('start_date')->index(); @@ -28,7 +28,7 @@ public function up(): void //add to organizations email, city, state, zip Schema::table('organizations', function (Blueprint $table) { - $table->string('email')->after('name')->index()->nullable(); + $table->string('email')->after('name')->nullable(); $table->string('city')->after('email')->nullable(); $table->string('state')->after('city')->nullable(); $table->string('zip')->after('state')->nullable(); diff --git a/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php b/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php index cd99e80dd0..96c4477bc4 100644 --- a/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php +++ b/src/Domains/Connectors/Apollo/Actions/ScreeningAction.php @@ -26,6 +26,7 @@ public function execute(): array $linkedin = $this->people->contacts() ->where('contacts_types_id', ContactType::getByName('LinkedIn')->getId()) ->first(); + $data = [ 'first_name' => $this->people->firstname, 'last_name' => $this->people->lastname, @@ -35,7 +36,6 @@ public function execute(): array ]; try { - // Envía la solicitud POST a la API de Apollo.io $response = $client->post('https://api.apollo.io/v1/people/match', [ 'headers' => [ 'Content-Type' => 'application/json', diff --git a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php index 77cf2aec8f..2f88d068ca 100644 --- a/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php +++ b/src/Domains/Connectors/Apollo/Workflows/Activities/ScreeningPeopleActivity.php @@ -22,12 +22,12 @@ public function execute(Model $people, AppInterface $app, array $params): array { $peopleData = (new ScreeningAction($people, $app))->execute(); - $history = []; foreach ($peopleData['employment_history'] as $employmentHistory) { $organization = new CreateOrganizationAction( new Organization( $people->company, $people->user, + $app, $employmentHistory['organization_name'], $employmentHistory['raw_address'], ) @@ -42,24 +42,27 @@ public function execute(Model $people, AppInterface $app, array $params): array 'organizations_id' => $organization->execute()->getId(), ]); } - $country = Countries::where('name', $peopleData['country'])->first(); - $address = Address::firstOrCreate([ - 'peoples_id' => $people->id, - 'address' => ' ', - 'address_2' => ' ', - 'city' => $peopleData['city'], - 'state' => $peopleData['state'], - 'county' => '', - 'zip' => ' ', - 'city_id' => 0, - 'state_id' => 0, - 'countries_id' => $country->getId(), - ]); + + if (isset($peopleData['country']) && isset($peopleData['state']) && isset($peopleData['city'])) { + $country = isset($peopleData['country']) && ! empty($peopleData['country']) ? Countries::where('name', $peopleData['country'])->first() : Countries::where('name', 'United States')->first(); + Address::firstOrCreate([ + 'peoples_id' => $people->id, + 'address' => ' ', + 'address_2' => ' ', + 'city' => $peopleData['city'], + 'state' => $peopleData['state'], + 'county' => '', + 'zip' => ' ', + 'city_id' => 0, + 'state_id' => 0, + 'countries_id' => $country->getId(), + ]); + } return [ 'status' => 'success', 'message' => 'People screened successfully', - 'people' => $people->id, + 'people_id' => $people->id, ]; } } diff --git a/src/Domains/Connectors/Apollo/Workflows/ScreeningPeopleWorkflow.php b/src/Domains/Connectors/Apollo/Workflows/ScreeningPeopleWorkflow.php new file mode 100644 index 0000000000..5dd1816594 --- /dev/null +++ b/src/Domains/Connectors/Apollo/Workflows/ScreeningPeopleWorkflow.php @@ -0,0 +1,20 @@ + $name, + 'companies_id' => 0, + 'users_id' => 1 + ]); + } } diff --git a/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php b/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistoryObserver.php similarity index 91% rename from src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php rename to src/Domains/Guild/Customers/Observers/PeopleEmploymentHistoryObserver.php index f3703b799f..945e555089 100644 --- a/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistory.php +++ b/src/Domains/Guild/Customers/Observers/PeopleEmploymentHistoryObserver.php @@ -7,7 +7,7 @@ use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory as ModelsPeopleEmploymentHistory; use Kanvas\Guild\Organizations\Models\OrganizationPeople; -class PeopleEmploymentHistory +class PeopleEmploymentHistoryObserver { public function created(ModelsPeopleEmploymentHistory $peopleHistory): void { diff --git a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php index 1dcf6bb129..6a2a4c08f0 100644 --- a/src/Domains/Guild/Organizations/Models/OrganizationPeople.php +++ b/src/Domains/Guild/Organizations/Models/OrganizationPeople.php @@ -50,6 +50,8 @@ public static function addPeopleToOrganization(Organization $organization, Peopl return self::firstOrCreate([ 'organizations_id' => $organization->getId(), 'peoples_id' => $people->getId(), + ], [ + 'created_at' => date('Y-m-d H:i:s'), ]); } } diff --git a/tests/Connectors/Integration/Apollo/PeopleScreeningTest.php b/tests/Connectors/Integration/Apollo/PeopleScreeningTest.php new file mode 100644 index 0000000000..9857cbeb1d --- /dev/null +++ b/tests/Connectors/Integration/Apollo/PeopleScreeningTest.php @@ -0,0 +1,37 @@ +user(); + $company = $user->getCurrentCompany(); + $app->set('apollo-api-key', getenv('TEST_APOLLO_KEY')); + + $people = People::factory()->withAppId($app->getId())->withCompanyId($company->getId())->create(); + $company = $people->company; + + $activity = new ScreeningPeopleActivity( + 0, + now()->toDateTimeString(), + StoredWorkflow::make(), + [] + ); + + $result = $activity->execute($people, $app, ['company' => $company]); + + $this->assertSame('success', $result['status']); + $this->assertSame($people->getId(), $result['people_id']); + } +} From eb5f5ec62c3b7da8e7c4302668cf97861d36cf44 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 14:43:05 -0400 Subject: [PATCH 25/58] refact: add static analysis --- .github/workflows/static-analysis.yml | 1 + .github/workflows/tests.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3875065108..73797611a5 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -57,6 +57,7 @@ jobs: TEST_SHOPIFY_API_SECRET: ${{ secrets.TEST_SHOPIFY_API_SECRET }} TEST_SHOPIFY_SHOP_URL: ${{ secrets.TEST_SHOPIFY_SHOP_URL }} TEST_APPLE_LOGIN_TOKEN: ${{ secrets.TEST_APPLE_LOGIN_TOKEN }} + TEST_APOLLO_KEY: ${{ secrets.TEST_APOLLO_KEY }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b6d30f3e79..381222f0e6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,6 +65,7 @@ jobs: TEST_SHOPIFY_API_SECRET: ${{ secrets.TEST_SHOPIFY_API_SECRET }} TEST_SHOPIFY_SHOP_URL: ${{ secrets.TEST_SHOPIFY_SHOP_URL }} TEST_APPLE_LOGIN_TOKEN: ${{ secrets.TEST_APPLE_LOGIN_TOKEN }} + TEST_APOLLO_KEY: ${{ secrets.TEST_APOLLO_KEY }} strategy: fail-fast: false matrix: From ce79b16ee0f5ff4566f286ca134f43c4ab99017f Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 15:13:20 -0400 Subject: [PATCH 26/58] refact: observer --- app/Providers/EventServiceProvider.php | 3 +++ .../Customers/Actions/CreatePeopleAction.php | 10 +-------- .../Customers/Observers/PeopleObserver.php | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 src/Domains/Guild/Customers/Observers/PeopleObserver.php diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 8d4cd05c07..63e4d5125f 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -9,8 +9,10 @@ use Kanvas\Companies\Models\Companies; use Kanvas\Companies\Models\CompaniesGroups; use Kanvas\Companies\Observers\CompaniesObserver; +use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Customers\Models\PeopleEmploymentHistory; use Kanvas\Guild\Customers\Observers\PeopleEmploymentHistoryObserver; +use Kanvas\Guild\Customers\Observers\PeopleObserver; use Kanvas\Guild\Leads\Models\Lead; use Kanvas\Guild\Leads\Observers\LeadObserver; use Kanvas\Inventory\Categories\Observers\ProductsCategoriesObserver; @@ -82,6 +84,7 @@ public function boot() UserCompanyApps::observe(UsersAssociatedCompaniesObserver::class); ProductsCategories::observe(ProductsCategoriesObserver::class); PeopleEmploymentHistory::observe(PeopleEmploymentHistoryObserver::class); + People::observe(PeopleObserver::class); } /** diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index f930ef4131..47345e9aa0 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -113,15 +113,7 @@ public function execute(): People $people->address()->saveMany($addressesToAdd); } } - - $people->fireWorkflow( - WorkflowEnum::CREATED->value, - true, - [ - 'app' => $this->peopleData->app, - ] - ); - + return $people; } } diff --git a/src/Domains/Guild/Customers/Observers/PeopleObserver.php b/src/Domains/Guild/Customers/Observers/PeopleObserver.php new file mode 100644 index 0000000000..a38e19db52 --- /dev/null +++ b/src/Domains/Guild/Customers/Observers/PeopleObserver.php @@ -0,0 +1,22 @@ +fireWorkflow( + WorkflowEnum::CREATED->value, + true, + [ + 'app' => $people->app, + ] + ); + } +} From 9638dfa5681c9dbff091c541c00ffba399a14aa8 Mon Sep 17 00:00:00 2001 From: kaioken Date: Wed, 19 Jun 2024 15:28:23 -0400 Subject: [PATCH 27/58] refact: observer --- src/Domains/Guild/Customers/Actions/CreatePeopleAction.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php index 47345e9aa0..91ca58a2c7 100644 --- a/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php +++ b/src/Domains/Guild/Customers/Actions/CreatePeopleAction.php @@ -10,7 +10,6 @@ use Kanvas\Guild\Customers\Models\Contact; use Kanvas\Guild\Customers\Models\People; use Kanvas\Guild\Customers\Repositories\PeoplesRepository; -use Kanvas\Workflow\Enums\WorkflowEnum; class CreatePeopleAction { @@ -113,7 +112,7 @@ public function execute(): People $people->address()->saveMany($addressesToAdd); } } - + return $people; } } From 4bde146f56f3232d6bac34ba40ea519bd3c6d54b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:10:35 +0000 Subject: [PATCH 28/58] build(deps-dev): bump phpunit/phpunit from 11.2.2 to 11.2.3 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.2.2 to 11.2.3. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/11.2.3/ChangeLog-11.2.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/11.2.2...11.2.3) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index f71614706e..ab7ba8235e 100644 --- a/composer.lock +++ b/composer.lock @@ -14523,16 +14523,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.2", + "version": "11.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e1843a58adc9c433ee6170bdee7d615f7ccc20b" + "reference": "8475044fbb0af57c8daea06bcfe21e2785401f97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e1843a58adc9c433ee6170bdee7d615f7ccc20b", - "reference": "3e1843a58adc9c433ee6170bdee7d615f7ccc20b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8475044fbb0af57c8daea06bcfe21e2785401f97", + "reference": "8475044fbb0af57c8daea06bcfe21e2785401f97", "shasum": "" }, "require": { @@ -14556,7 +14556,7 @@ "sebastian/comparator": "^6.0", "sebastian/diff": "^6.0", "sebastian/environment": "^7.0", - "sebastian/exporter": "^6.0", + "sebastian/exporter": "^6.1.2", "sebastian/global-state": "^7.0", "sebastian/object-enumerator": "^6.0", "sebastian/type": "^5.0", @@ -14603,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.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.3" }, "funding": [ { @@ -14619,7 +14619,7 @@ "type": "tidelift" } ], - "time": "2024-06-15T09:14:53+00:00" + "time": "2024-06-19T05:31:11+00:00" }, { "name": "sebastian/cli-parser", @@ -15059,16 +15059,16 @@ }, { "name": "sebastian/exporter", - "version": "6.0.1", + "version": "6.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da" + "reference": "507d2333cbc4e6ea248fbda2d45ee1511e03da13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f291e5a317c321c0381fa9ecc796fa2d21b186da", - "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/507d2333cbc4e6ea248fbda2d45ee1511e03da13", + "reference": "507d2333cbc4e6ea248fbda2d45ee1511e03da13", "shasum": "" }, "require": { @@ -15077,12 +15077,12 @@ "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -15125,7 +15125,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/exporter/tree/6.1.2" }, "funding": [ { @@ -15133,7 +15133,7 @@ "type": "github" } ], - "time": "2024-03-02T07:28:20+00:00" + "time": "2024-06-18T11:19:56+00:00" }, { "name": "sebastian/global-state", @@ -15371,16 +15371,16 @@ }, { "name": "sebastian/recursion-context", - "version": "6.0.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4" + "reference": "2f15508e17af4ea35129bbc32ce28a814d9c7426" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b75224967b5a466925c6d54e68edd0edf8dd4ed4", - "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2f15508e17af4ea35129bbc32ce28a814d9c7426", + "reference": "2f15508e17af4ea35129bbc32ce28a814d9c7426", "shasum": "" }, "require": { @@ -15423,7 +15423,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.0" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.1" }, "funding": [ { @@ -15431,7 +15431,7 @@ "type": "github" } ], - "time": "2024-02-02T06:08:48+00:00" + "time": "2024-06-17T05:22:57+00:00" }, { "name": "sebastian/type", From 4ce01d5062ea81f3d7f02997181abaefcb68db7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:10:50 +0000 Subject: [PATCH 29/58] build(deps): bump nuwave/lighthouse from 6.37.1 to 6.38.0 Bumps [nuwave/lighthouse](https://github.com/nuwave/lighthouse) from 6.37.1 to 6.38.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.37.1...v6.38.0) --- updated-dependencies: - dependency-name: nuwave/lighthouse dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 135 +++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 68 deletions(-) diff --git a/composer.lock b/composer.lock index f71614706e..2c503fe58f 100644 --- a/composer.lock +++ b/composer.lock @@ -6381,16 +6381,16 @@ }, { "name": "nuwave/lighthouse", - "version": "v6.37.1", + "version": "v6.38.0", "source": { "type": "git", "url": "https://github.com/nuwave/lighthouse.git", - "reference": "ea496a2a6fc31e10a08689105c58a77418b85426" + "reference": "d15b988aaf18938d39d58ac0bb9c155928b409db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/ea496a2a6fc31e10a08689105c58a77418b85426", - "reference": "ea496a2a6fc31e10a08689105c58a77418b85426", + "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/d15b988aaf18938d39d58ac0bb9c155928b409db", + "reference": "d15b988aaf18938d39d58ac0bb9c155928b409db", "shasum": "" }, "require": { @@ -6511,7 +6511,7 @@ "type": "patreon" } ], - "time": "2024-06-17T08:59:30+00:00" + "time": "2024-06-19T10:13:56+00:00" }, { "name": "nyholm/psr7", @@ -11224,16 +11224,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { @@ -11283,7 +11283,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -11299,20 +11299,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -11361,7 +11361,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -11377,20 +11377,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919" + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a287ed7475f85bf6f61890146edbc932c0fff919", - "reference": "a287ed7475f85bf6f61890146edbc932c0fff919", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", "shasum": "" }, "require": { @@ -11445,7 +11445,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" }, "funding": [ { @@ -11461,20 +11461,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -11526,7 +11526,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -11542,20 +11542,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -11606,7 +11606,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -11622,20 +11622,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" + "reference": "10112722600777e02d2745716b70c5db4ca70442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", - "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", + "reference": "10112722600777e02d2745716b70c5db4ca70442", "shasum": "" }, "require": { @@ -11679,7 +11679,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" }, "funding": [ { @@ -11695,20 +11695,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -11759,7 +11759,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -11775,25 +11775,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff" + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-php80": "^1.14" + "php": ">=7.1" }, "type": "library", "extra": { @@ -11836,7 +11835,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" }, "funding": [ { @@ -11852,20 +11851,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:35:24+00:00" }, { "name": "symfony/polyfill-uuid", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853" + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/3abdd21b0ceaa3000ee950097bc3cf9efc137853", - "reference": "3abdd21b0ceaa3000ee950097bc3cf9efc137853", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9", + "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9", "shasum": "" }, "require": { @@ -11915,7 +11914,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0" }, "funding": [ { @@ -11931,7 +11930,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/process", @@ -13446,16 +13445,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.12.3", + "version": "v15.12.4", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9" + "reference": "4ddba1634c4c2d09c39623d6c13fa550588ed8b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9", - "reference": "7e3ef03e1962bce7fd54c2841e6f8d3603a7c5f9", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/4ddba1634c4c2d09c39623d6c13fa550588ed8b1", + "reference": "4ddba1634c4c2d09c39623d6c13fa550588ed8b1", "shasum": "" }, "require": { @@ -13473,7 +13472,7 @@ "nyholm/psr7": "^1.5", "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "1.11.4", + "phpstan/phpstan": "1.11.5", "phpstan/phpstan-phpunit": "1.4.0", "phpstan/phpstan-strict-rules": "1.6.0", "phpunit/phpunit": "^9.5 || ^10.5.21", @@ -13508,7 +13507,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.12.3" + "source": "https://github.com/webonyx/graphql-php/tree/v15.12.4" }, "funding": [ { @@ -13516,7 +13515,7 @@ "type": "open_collective" } ], - "time": "2024-06-17T09:32:30+00:00" + "time": "2024-06-19T13:54:11+00:00" } ], "packages-dev": [ From 952f288fad3db3b19afe5178ff3ef3d78552f166 Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 20 Jun 2024 12:41:53 -0400 Subject: [PATCH 30/58] refact: none admin user cant invite admin --- src/Kanvas/AccessControlList/Models/Role.php | 11 +++++++++++ src/Kanvas/Users/Actions/CreateInviteAction.php | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Kanvas/AccessControlList/Models/Role.php b/src/Kanvas/AccessControlList/Models/Role.php index d1903b2505..a34336e5d2 100644 --- a/src/Kanvas/AccessControlList/Models/Role.php +++ b/src/Kanvas/AccessControlList/Models/Role.php @@ -5,6 +5,7 @@ namespace Kanvas\AccessControlList\Models; use Illuminate\Support\Facades\Redis; +use Kanvas\AccessControlList\Enums\RolesEnums; use Laravel\Scout\Searchable; use Silber\Bouncer\Database\Role as SilberRole; @@ -40,4 +41,14 @@ public function getAbilitiesCountAttribute(): int return (int)$count; } + + public function isAdmin(): bool + { + return $this->name === RolesEnums::ADMIN->value; + } + + public function isOwner(): bool + { + return $this->name === RolesEnums::OWNER->value; + } } diff --git a/src/Kanvas/Users/Actions/CreateInviteAction.php b/src/Kanvas/Users/Actions/CreateInviteAction.php index cdfa882e02..84ee0c989c 100644 --- a/src/Kanvas/Users/Actions/CreateInviteAction.php +++ b/src/Kanvas/Users/Actions/CreateInviteAction.php @@ -37,11 +37,16 @@ public function execute(): UsersInvite ); //validate role - RolesRepository::getByIdFromCompany( + $role = RolesRepository::getByIdFromCompany( $this->inviteDto->role_id, - $company + $company, + $this->inviteDto->app ); + if (($role->isAdmin() || $role->isOwner()) && ! $this->user->isAdmin()) { + throw new \Exception('You can\'t invite an admin or owner'); + } + $invite = new UsersInvite(); $invite->fill([ 'invite_hash' => Str::random(50), From b884a831dc2247092fe648511f1dc45dee133fc1 Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 20 Jun 2024 12:42:50 -0400 Subject: [PATCH 31/58] refact: exception --- src/Kanvas/Users/Actions/CreateInviteAction.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Kanvas/Users/Actions/CreateInviteAction.php b/src/Kanvas/Users/Actions/CreateInviteAction.php index 84ee0c989c..dfc1961481 100644 --- a/src/Kanvas/Users/Actions/CreateInviteAction.php +++ b/src/Kanvas/Users/Actions/CreateInviteAction.php @@ -9,6 +9,7 @@ use Kanvas\AccessControlList\Repositories\RolesRepository; use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Enums\AppSettingsEnums; +use Kanvas\Exceptions\ValidationException; use Kanvas\Notifications\Templates\Invite as InviteTemplate; use Kanvas\Users\DataTransferObject\Invite as InviteDto; use Kanvas\Users\Models\Users; @@ -39,12 +40,12 @@ public function execute(): UsersInvite //validate role $role = RolesRepository::getByIdFromCompany( $this->inviteDto->role_id, - $company, + $company, $this->inviteDto->app ); if (($role->isAdmin() || $role->isOwner()) && ! $this->user->isAdmin()) { - throw new \Exception('You can\'t invite an admin or owner'); + throw new ValidationException('You can\'t invite an admin or owner'); } $invite = new UsersInvite(); From 081995a1d661ce7d48228b11b55b18a1825e7538 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:08:27 +0000 Subject: [PATCH 32/58] build(deps): bump twilio/sdk from 8.1.1 to 8.2.0 Bumps [twilio/sdk](https://github.com/twilio/twilio-php) from 8.1.1 to 8.2.0. - [Release notes](https://github.com/twilio/twilio-php/releases) - [Changelog](https://github.com/twilio/twilio-php/blob/main/CHANGES.md) - [Commits](https://github.com/twilio/twilio-php/compare/8.1.1...8.2.0) --- updated-dependencies: - dependency-name: twilio/sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 8ca591f553..0a20489e90 100644 --- a/composer.lock +++ b/composer.lock @@ -12990,16 +12990,16 @@ }, { "name": "twilio/sdk", - "version": "8.1.1", + "version": "8.2.0", "source": { "type": "git", "url": "https://github.com/twilio/twilio-php.git", - "reference": "d59f57a548e2659fb305be11690b7b0aaf40a84c" + "reference": "e634588785d07cf7db584fa3b73203406e11064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twilio/twilio-php/zipball/d59f57a548e2659fb305be11690b7b0aaf40a84c", - "reference": "d59f57a548e2659fb305be11690b7b0aaf40a84c", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/e634588785d07cf7db584fa3b73203406e11064e", + "reference": "e634588785d07cf7db584fa3b73203406e11064e", "shasum": "" }, "require": { @@ -13037,9 +13037,9 @@ ], "support": { "issues": "https://github.com/twilio/twilio-php/issues", - "source": "https://github.com/twilio/twilio-php/tree/8.1.1" + "source": "https://github.com/twilio/twilio-php/tree/8.2.0" }, - "time": "2024-06-06T11:46:47+00:00" + "time": "2024-06-20T10:39:28+00:00" }, { "name": "vladimir-yuldashev/laravel-queue-rabbitmq", From a4c79e4c1261f55da38b82040411c707bbba7d26 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:08:36 +0000 Subject: [PATCH 33/58] build(deps-dev): bump phpunit/phpunit from 11.2.3 to 11.2.5 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.2.3 to 11.2.5. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/11.2.5/ChangeLog-11.2.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/11.2.3...11.2.5) --- 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 8ca591f553..08eec415ee 100644 --- a/composer.lock +++ b/composer.lock @@ -14522,16 +14522,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.3", + "version": "11.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8475044fbb0af57c8daea06bcfe21e2785401f97" + "reference": "be9e3ed32a1287a9bfda15936cc86fef4e4cf591" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8475044fbb0af57c8daea06bcfe21e2785401f97", - "reference": "8475044fbb0af57c8daea06bcfe21e2785401f97", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/be9e3ed32a1287a9bfda15936cc86fef4e4cf591", + "reference": "be9e3ed32a1287a9bfda15936cc86fef4e4cf591", "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.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.5" }, "funding": [ { @@ -14618,7 +14618,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T05:31:11+00:00" + "time": "2024-06-20T13:11:31+00:00" }, { "name": "sebastian/cli-parser", From 7ca4a4cf9eec3c1211a40e84983d6715dc25a955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:29:04 +0000 Subject: [PATCH 34/58] build(deps): bump nuwave/lighthouse from 6.38.0 to 6.38.1 Bumps [nuwave/lighthouse](https://github.com/nuwave/lighthouse) from 6.38.0 to 6.38.1. - [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.38.0...v6.38.1) --- updated-dependencies: - dependency-name: nuwave/lighthouse dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index 8ca591f553..6c797d3c42 100644 --- a/composer.lock +++ b/composer.lock @@ -3906,16 +3906,16 @@ }, { "name": "laravel/framework", - "version": "v11.11.0", + "version": "v11.11.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa" + "reference": "c9b52e84bd18f155e5ba59b948c7da3e7f37e87f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/194102876df42f9f5bb618efa55fa7e15ebf40aa", - "reference": "194102876df42f9f5bb618efa55fa7e15ebf40aa", + "url": "https://api.github.com/repos/laravel/framework/zipball/c9b52e84bd18f155e5ba59b948c7da3e7f37e87f", + "reference": "c9b52e84bd18f155e5ba59b948c7da3e7f37e87f", "shasum": "" }, "require": { @@ -4107,7 +4107,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-06-18T17:40:27+00:00" + "time": "2024-06-20T10:54:53+00:00" }, { "name": "laravel/octane", @@ -5919,16 +5919,16 @@ }, { "name": "nesbot/carbon", - "version": "3.5.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "415782b7e48223342f1a616c16c45a95b15b2318" + "reference": "39c8ef752db6865717cc3fba63970c16f057982c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/415782b7e48223342f1a616c16c45a95b15b2318", - "reference": "415782b7e48223342f1a616c16c45a95b15b2318", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/39c8ef752db6865717cc3fba63970c16f057982c", + "reference": "39c8ef752db6865717cc3fba63970c16f057982c", "shasum": "" }, "require": { @@ -6021,7 +6021,7 @@ "type": "tidelift" } ], - "time": "2024-06-03T17:25:54+00:00" + "time": "2024-06-20T15:52:59+00:00" }, { "name": "nette/schema", @@ -6381,16 +6381,16 @@ }, { "name": "nuwave/lighthouse", - "version": "v6.38.0", + "version": "v6.38.1", "source": { "type": "git", "url": "https://github.com/nuwave/lighthouse.git", - "reference": "d15b988aaf18938d39d58ac0bb9c155928b409db" + "reference": "16ffb6f45207b7cb25697730694b14887f736421" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/d15b988aaf18938d39d58ac0bb9c155928b409db", - "reference": "d15b988aaf18938d39d58ac0bb9c155928b409db", + "url": "https://api.github.com/repos/nuwave/lighthouse/zipball/16ffb6f45207b7cb25697730694b14887f736421", + "reference": "16ffb6f45207b7cb25697730694b14887f736421", "shasum": "" }, "require": { @@ -6511,7 +6511,7 @@ "type": "patreon" } ], - "time": "2024-06-19T10:13:56+00:00" + "time": "2024-06-21T10:12:39+00:00" }, { "name": "nyholm/psr7", From 86b065175214bdb45da530ebbf4d37f9318bb87f Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 01:27:47 -0400 Subject: [PATCH 35/58] refact: add custom field to company --- .../Companies/CompanyManagementMutation.php | 13 +-- graphql/schemas/Ecosystem/company.graphql | 1 + src/Kanvas/Auth/Actions/CreateUserAction.php | 10 +- .../Actions/CreateCompaniesAction.php | 9 +- .../Actions/UpdateCompaniesAction.php | 17 ++-- .../DataTransferObject/CompaniesPostData.php | 95 ------------------- .../DataTransferObject/CompaniesPutData.php | 94 ------------------ .../Companies/DataTransferObject/Company.php | 49 ++++++++++ src/Kanvas/Companies/Models/Companies.php | 8 +- .../DefaultTemplateRepository.php | 8 +- .../Companies/CreateCompaniesActionTest.php | 8 +- .../Companies/UpdateCompaniesActionTest.php | 8 +- 12 files changed, 84 insertions(+), 236 deletions(-) delete mode 100644 src/Kanvas/Companies/DataTransferObject/CompaniesPostData.php delete mode 100644 src/Kanvas/Companies/DataTransferObject/CompaniesPutData.php create mode 100644 src/Kanvas/Companies/DataTransferObject/Company.php diff --git a/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php b/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php index b6da26703a..def8dba4a1 100644 --- a/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php +++ b/app/GraphQL/Ecosystem/Mutations/Companies/CompanyManagementMutation.php @@ -11,8 +11,8 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Actions\CreateCompaniesAction; use Kanvas\Companies\Actions\UpdateCompaniesAction; -use Kanvas\Companies\DataTransferObject\CompaniesPostData; use Kanvas\Companies\DataTransferObject\CompaniesPutData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Companies\Jobs\DeleteCompanyJob; use Kanvas\Companies\Models\Companies; use Kanvas\Companies\Models\CompaniesBranches; @@ -34,11 +34,10 @@ public function createCompany(mixed $root, array $request): Companies if (auth()->user()->isAdmin() && key_exists('users_id', $request['input'])) { $user = Users::getById($request['input']['users_id']); UsersRepository::belongsToThisApp($user, app(Apps::class)) ; - $request['input']['users_id'] = $user->getKey(); } else { - $request['input']['users_id'] = Auth::user()->getKey(); + $user = auth()->user(); } - $dto = CompaniesPostData::fromArray($request['input']); + $dto = Company::viaRequest($request['input'], $user); $action = new CreateCompaniesAction($dto); return $action->execute(); @@ -52,12 +51,10 @@ public function updateCompany(mixed $root, array $request): Companies if (auth()->user()->isAdmin() && key_exists('users_id', $request['input'])) { $user = Users::getById($request['input']['users_id']); UsersRepository::belongsToThisApp($user, app(Apps::class)) ; - $request['input']['users_id'] = $user->getKey(); } else { - $request['input']['users_id'] = Auth::user()->getKey(); - $user = Auth::user(); + $user = auth()->user(); } - $dto = CompaniesPutData::fromArray($request['input']); + $dto = Company::viaRequest($request['input'], $user); $action = new UpdateCompaniesAction($user, $dto); return $action->execute((int) $request['id']); diff --git a/graphql/schemas/Ecosystem/company.graphql b/graphql/schemas/Ecosystem/company.graphql index 8041e269ee..cabfdb76b9 100644 --- a/graphql/schemas/Ecosystem/company.graphql +++ b/graphql/schemas/Ecosystem/company.graphql @@ -105,6 +105,7 @@ input CompanyInput { country_code: String users_id: Int files: [FilesystemInputUrl] + custom_fields: [CustomFieldEntityInput!] is_active: Boolean } diff --git a/src/Kanvas/Auth/Actions/CreateUserAction.php b/src/Kanvas/Auth/Actions/CreateUserAction.php index 20f4b5a5b0..5ea146a600 100644 --- a/src/Kanvas/Auth/Actions/CreateUserAction.php +++ b/src/Kanvas/Auth/Actions/CreateUserAction.php @@ -15,7 +15,7 @@ use Kanvas\Auth\DataTransferObject\RegisterInput; use Kanvas\Auth\Exceptions\AuthenticationException; use Kanvas\Companies\Actions\CreateCompaniesAction; -use Kanvas\Companies\DataTransferObject\CompaniesPostData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Enums\AppEnums; use Kanvas\Enums\AppSettingsEnums; use Kanvas\Enums\StateEnums; @@ -214,10 +214,10 @@ protected function onBoarding(Users $user, ?CompanyInterface $company = null): v protected function createCompany(Users $user): CompanyInterface { $createCompany = new CreateCompaniesAction( - new CompaniesPostData( - $user->defaultCompanyName ?? $user->displayname . 'CP', - $user->getId(), - $user->email + new Company( + user: $user, + name: $user->defaultCompanyName ?? $user->displayname . 'CP', + email: $user->email ) ); diff --git a/src/Kanvas/Companies/Actions/CreateCompaniesAction.php b/src/Kanvas/Companies/Actions/CreateCompaniesAction.php index 8b4c684a21..a97f045836 100644 --- a/src/Kanvas/Companies/Actions/CreateCompaniesAction.php +++ b/src/Kanvas/Companies/Actions/CreateCompaniesAction.php @@ -5,6 +5,7 @@ namespace Kanvas\Companies\Actions; use Kanvas\Companies\DataTransferObject\CompaniesPostData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Companies\Models\Companies; class CreateCompaniesAction @@ -13,7 +14,7 @@ class CreateCompaniesAction * Construct function. */ public function __construct( - protected CompaniesPostData $data + protected Company $data ) { } @@ -26,7 +27,7 @@ public function execute(): Companies { $companies = new Companies(); $companies->name = $this->data->name; - $companies->users_id = $this->data->users_id; + $companies->users_id = $this->data->user->getId(); $companies->website = $this->data->website; $companies->phone = $this->data->phone; $companies->address = $this->data->address; @@ -43,6 +44,10 @@ public function execute(): Companies $companies->addMultipleFilesFromUrl($this->data->files); } + if ($this->data->custom_fields) { + $companies->setAll($this->data->custom_fields); + } + return $companies; } } diff --git a/src/Kanvas/Companies/Actions/UpdateCompaniesAction.php b/src/Kanvas/Companies/Actions/UpdateCompaniesAction.php index c7e3794713..5a3256d635 100644 --- a/src/Kanvas/Companies/Actions/UpdateCompaniesAction.php +++ b/src/Kanvas/Companies/Actions/UpdateCompaniesAction.php @@ -4,30 +4,21 @@ namespace Kanvas\Companies\Actions; -use Kanvas\Companies\DataTransferObject\CompaniesPutData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Companies\Models\Companies; use Kanvas\Companies\Repositories\CompaniesRepository; use Kanvas\Users\Models\Users; class UpdateCompaniesAction { - /** - * Construct function. - * - * @param CompaniesPutData $data - */ public function __construct( protected Users $user, - protected CompaniesPutData $data + protected Company $data ) { } /** * Invoke function. - * - * @param int $id - * - * @return Companies */ public function execute(int $id): Companies { @@ -40,6 +31,10 @@ public function execute(int $id): Companies $companies->addMultipleFilesFromUrl($this->data->files); } + if ($this->data->custom_fields) { + $companies->setAll($this->data->custom_fields); + } + return $companies; } } diff --git a/src/Kanvas/Companies/DataTransferObject/CompaniesPostData.php b/src/Kanvas/Companies/DataTransferObject/CompaniesPostData.php deleted file mode 100644 index 0e712dd6d4..0000000000 --- a/src/Kanvas/Companies/DataTransferObject/CompaniesPostData.php +++ /dev/null @@ -1,95 +0,0 @@ -id, - name: $request->get('name'), - ); - } - - /** - * Create new instance of DTO from Console Command. - * - * @param array $data Input data - */ - public static function fromConsole(array $data): self - { - return new self( - name: $data['name'], - users_id : $data['users_id'], - email : $data['email'] ?? null, - phone : $data['phone'] ?? null, - currency_id : $data['currency_id'] ?? null, - website : $data['website'] ?? null, - address : $data['address'] ?? null, - zipcode : $data['zipcode'] ?? null, - language : $data['language'] ?? null, - timezone : $data['timezone'] ?? null, - country_code : $data['country_code'] ?? null, - ); - } - - /** - * Create new instance of DTO from array of data. - * - * @param array $data Input data - */ - public static function fromArray(array $data): self - { - return new self( - name: $data['name'], - users_id : $data['users_id'], - email : $data['email'] ?? null, - phone : $data['phone'] ?? null, - currency_id : $data['currency_id'] ?? null, - website : $data['website'] ?? null, - address : $data['address'] ?? null, - zipcode : $data['zipcode'] ?? null, - language : $data['language'] ?? null, - timezone : $data['timezone'] ?? null, - country_code : $data['country_code'] ?? null, - files: $data['files'] ?? null - ); - } -} diff --git a/src/Kanvas/Companies/DataTransferObject/CompaniesPutData.php b/src/Kanvas/Companies/DataTransferObject/CompaniesPutData.php deleted file mode 100644 index 5811649207..0000000000 --- a/src/Kanvas/Companies/DataTransferObject/CompaniesPutData.php +++ /dev/null @@ -1,94 +0,0 @@ -get('users_id'), - currency_id: (int)$request->get('currency_id'), - name: $request->get('name'), - website: $request->get('website'), - address: $request->get('address'), - zipcode: (int) $request->get('zipcode'), - email: $request->get('email'), - language: $request->get('language'), - timezone: $request->get('timezone'), - phone: $request->get('phone'), - country_code: $request->get('country_code'), - files: $request->get('files') ?? null, - is_active: $request->get('is_active') ?? true - ); - } - - /** - * Create new instance of DTO from array of data. - * - * @param array $data Input data - */ - public static function fromArray(array $data): self - { - return new self( - users_id: (int) $data['users_id'], - name: $data['name'], - currency_id: $data['currency_id'] ?? null, - website: $data['website'] ?? null, - address: $data['address'] ?? null, - zipcode: $data['zipcode'] ?? null, - email: $data['email'] ?? null, - language: $data['language'] ?? null, - timezone: $data['timezone'] ?? null, - phone:$data['phone'] ?? null, - country_code: $data['country_code'] ?? null, - files: $data['files'] ?? null, - is_active: $data['is_active'] ?? true - ); - } -} diff --git a/src/Kanvas/Companies/DataTransferObject/Company.php b/src/Kanvas/Companies/DataTransferObject/Company.php new file mode 100644 index 0000000000..b01ff20fe8 --- /dev/null +++ b/src/Kanvas/Companies/DataTransferObject/Company.php @@ -0,0 +1,49 @@ +

- Copyright © {{date(\'Y\')}} mctekk, LLC. All rights reserved. + Copyright © {{date(\'Y\')}} Kanvas, INC. All rights reserved.

@@ -121,11 +121,11 @@ public static function getUsersInvite(): string return '

- Hi {{ $user.firstname}} {{ $user.lastname}}, + Hi {{ $entity->firstname}} {{ $entity->lastname}},

- You have been invited to {{ $fromUser.getCurrentBranch().name}} by {{ $fromUser.firstname}} {{ $fromUser.lastname}}. Please click the button below to create your account. + You have been invited to {{ $fromUser->getCurrentBranch()->name}} by {{ $fromUser->firstname}} {{ $fromUser->lastname}}. Please click the button below to create your account.

@@ -135,7 +135,7 @@ public static function getUsersInvite(): string diff --git a/tests/Ecosystem/Integration/Companies/CreateCompaniesActionTest.php b/tests/Ecosystem/Integration/Companies/CreateCompaniesActionTest.php index cae19170c8..a36b8a1ae7 100644 --- a/tests/Ecosystem/Integration/Companies/CreateCompaniesActionTest.php +++ b/tests/Ecosystem/Integration/Companies/CreateCompaniesActionTest.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Auth; use Kanvas\Companies\Actions\CreateCompaniesAction; -use Kanvas\Companies\DataTransferObject\CompaniesPostData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Companies\Models\Companies; use Kanvas\Users\Models\Users; use Tests\TestCase; @@ -15,8 +15,6 @@ final class CreateCompaniesActionTest extends TestCase { /** * Test Create Apps Action. - * - * @return void */ public function testCreateCompaniesAction(): void { @@ -24,10 +22,10 @@ public function testCreateCompaniesAction(): void $user = Users::factory(1)->create()->first(); $data = [ 'name' => $faker->company, - 'users_id' => Auth::user()->id + 'users_id' => Auth::user()->id, ]; - $dtoData = CompaniesPostData::fromArray($data); + $dtoData = Company::viaRequest($data, $user); $company = new CreateCompaniesAction($dtoData); diff --git a/tests/Ecosystem/Integration/Companies/UpdateCompaniesActionTest.php b/tests/Ecosystem/Integration/Companies/UpdateCompaniesActionTest.php index 10b215a91e..6c7aa3985b 100644 --- a/tests/Ecosystem/Integration/Companies/UpdateCompaniesActionTest.php +++ b/tests/Ecosystem/Integration/Companies/UpdateCompaniesActionTest.php @@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Auth; use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Actions\UpdateCompaniesAction; -use Kanvas\Companies\DataTransferObject\CompaniesPutData; +use Kanvas\Companies\DataTransferObject\Company; use Kanvas\Companies\Models\Companies; use Kanvas\Enums\AppEnums; use Kanvas\Enums\StateEnums; @@ -17,8 +17,6 @@ final class UpdateCompaniesActionTest extends TestCase { /** * Test Create Apps Action. - * - * @return void */ public function testUpdateCompaniesAction(): void { @@ -28,7 +26,7 @@ public function testUpdateCompaniesAction(): void $faker = \Faker\Factory::create(); $data = [ - 'users_id' => $company->users_id, + 'user' => $company->user, 'currency_id' => $company->currency_id, 'name' => $faker->company, 'profile_image' => $company->profile_image, @@ -42,7 +40,7 @@ public function testUpdateCompaniesAction(): void 'country_code' => $company->country_code, ]; - $dtoData = CompaniesPutData::fromArray($data); + $dtoData = Company::from($data); $updateCompany = new UpdateCompaniesAction(Auth::user(), $dtoData); From f4b35c57de1f766bad3877d65737ea6c515ce4b3 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 01:35:06 -0400 Subject: [PATCH 36/58] refact: required fields --- .../Companies/DataTransferObject/Company.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Kanvas/Companies/DataTransferObject/Company.php b/src/Kanvas/Companies/DataTransferObject/Company.php index b01ff20fe8..24bd773967 100644 --- a/src/Kanvas/Companies/DataTransferObject/Company.php +++ b/src/Kanvas/Companies/DataTransferObject/Company.php @@ -12,14 +12,14 @@ class Company extends Data public function __construct( public UserInterface $user, public string $name, - public ?string $website, - public ?string $address, - public ?int $zipcode, - public ?string $email, - public ?string $language, - public ?string $timezone, - public ?string $phone, - public ?string $country_code, + public ?string $website = null, + public ?string $address = null, + public ?int $zipcode = null, + public ?string $email = null, + public ?string $language = null, + public ?string $timezone = null, + public ?string $phone = null, + public ?string $country_code = null, public ?int $currency_id = null, public ?array $files = null, public array $custom_fields = [], From 1ef9db92c656add35bcd7e24a4935dd2d9ea3403 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 01:44:14 -0400 Subject: [PATCH 37/58] refact: fix type issue --- graphql/schemas/Ecosystem/company.graphql | 4 ++-- src/Kanvas/Companies/DataTransferObject/Company.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphql/schemas/Ecosystem/company.graphql b/graphql/schemas/Ecosystem/company.graphql index cabfdb76b9..081d7a8c64 100644 --- a/graphql/schemas/Ecosystem/company.graphql +++ b/graphql/schemas/Ecosystem/company.graphql @@ -104,7 +104,7 @@ input CompanyInput { phone: String country_code: String users_id: Int - files: [FilesystemInputUrl] + files: [FilesystemInputUrl!] custom_fields: [CustomFieldEntityInput!] is_active: Boolean } @@ -121,7 +121,7 @@ input CompanyBranchInput { language: String timezone: String phone: String - files: [FilesystemInputUrl] + files: [FilesystemInputUrl!] is_active: Boolean } diff --git a/src/Kanvas/Companies/DataTransferObject/Company.php b/src/Kanvas/Companies/DataTransferObject/Company.php index 24bd773967..f7d1b82376 100644 --- a/src/Kanvas/Companies/DataTransferObject/Company.php +++ b/src/Kanvas/Companies/DataTransferObject/Company.php @@ -31,11 +31,11 @@ public static function viaRequest(array $request, UserInterface $user): self { return new self( $user, - currency_id: (int)$request['currency_id'], + currency_id: ! empty($request['currency_id']) ? (int) $request['currency_id'] : null, name: $request['name'], website: $request['website'] ?? null, address: $request['address'] ?? null, - zipcode: (int) $request['zipcode'], + zipcode: ! empty($request['zipcode']) ? (int) $request['zipcode'] : null, email: $request['email'] ?? null, language: $request['language'] ?? null, timezone: $request['timezone'] ?? null, From 781bac089c2f3e85fc25eef801a3e9ef150a963c Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 01:44:28 -0400 Subject: [PATCH 38/58] refact: fix type issue --- src/Kanvas/Companies/DataTransferObject/Company.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kanvas/Companies/DataTransferObject/Company.php b/src/Kanvas/Companies/DataTransferObject/Company.php index f7d1b82376..a241a10891 100644 --- a/src/Kanvas/Companies/DataTransferObject/Company.php +++ b/src/Kanvas/Companies/DataTransferObject/Company.php @@ -30,7 +30,7 @@ public function __construct( public static function viaRequest(array $request, UserInterface $user): self { return new self( - $user, + user: $user, currency_id: ! empty($request['currency_id']) ? (int) $request['currency_id'] : null, name: $request['name'], website: $request['website'] ?? null, From 62c3a9d3f611134b461e57c366f09368e639e137 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 14:31:59 -0400 Subject: [PATCH 39/58] refact: default app email templates --- database/seeders/TemplateSeeder.php | 28 +-- .../views/emails/defaultTemplate.blade.php | 102 +++++++++ .../views/emails/passwordUpdated.blade.php | 11 + .../views/emails/pushNotification.blade.php | 5 + .../views/emails/resetPassword.blade.php | 24 ++ resources/views/emails/userInvite.blade.php | 24 ++ resources/views/emails/welcome.blade.php | 11 + src/Kanvas/Apps/Actions/CreateAppsAction.php | 34 ++- .../Actions/CreateTemplateAction.php | 3 +- .../DefaultTemplateRepository.php | 215 ------------------ 10 files changed, 218 insertions(+), 239 deletions(-) create mode 100644 resources/views/emails/defaultTemplate.blade.php create mode 100644 resources/views/emails/passwordUpdated.blade.php create mode 100644 resources/views/emails/pushNotification.blade.php create mode 100644 resources/views/emails/resetPassword.blade.php create mode 100644 resources/views/emails/userInvite.blade.php create mode 100644 resources/views/emails/welcome.blade.php delete mode 100644 src/Kanvas/Templates/Repositories/DefaultTemplateRepository.php diff --git a/database/seeders/TemplateSeeder.php b/database/seeders/TemplateSeeder.php index 830fa89170..4e923ebc21 100755 --- a/database/seeders/TemplateSeeder.php +++ b/database/seeders/TemplateSeeder.php @@ -3,8 +3,8 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\File; use Kanvas\Templates\Models\Templates; -use Kanvas\Templates\Repositories\DefaultTemplateRepository; class TemplateSeeder extends Seeder { @@ -16,14 +16,14 @@ class TemplateSeeder extends Seeder public function run() { - Templates::create([ + $defaultTemplate = Templates::create([ 'id' => 1, 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, 'parent_template_id' => 0, 'name' => 'Default', - 'template' => DefaultTemplateRepository::getDefaultTemplate(), + 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -34,7 +34,7 @@ public function run() 'companies_id' => 0, 'parent_template_id' => 0, 'name' => 'user-email-update', - 'template' => DefaultTemplateRepository::getDefaultTemplate(), + 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -44,8 +44,8 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'name' => 'users-invite', - 'parent_template_id' => 1, - 'template' => DefaultTemplateRepository::getUsersInvite(), + 'parent_template_id' => $defaultTemplate->id, + 'template' => File::get(resource_path('views/email/userInvite.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -55,8 +55,8 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'name' => 'change-password', - 'parent_template_id' => 1, - 'template' => DefaultTemplateRepository::getChangePassword(), + 'parent_template_id' => $defaultTemplate->id, + 'template' => File::get(resource_path('views/email/passwordUpdated.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -66,8 +66,8 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'name' => 'reset-password', - 'parent_template_id' => 1, - 'template' => DefaultTemplateRepository::getResetPassword(), + 'parent_template_id' => $defaultTemplate->id, + 'template' => File::get(resource_path('views/email/resetPassword.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -77,8 +77,8 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'name' => 'welcome', - 'parent_template_id' => 1, - 'template' => DefaultTemplateRepository::getWelcome(), + 'parent_template_id' => $defaultTemplate->id, + 'template' => File::get(resource_path('views/email/welcome.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -89,8 +89,8 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'name' => 'new-push-default', - 'parent_template_id' => 1, - 'template' => DefaultTemplateRepository::getNewPushDefault(), + 'parent_template_id' => 0, + 'template' => File::get(resource_path('views/email/pushNotification.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); } diff --git a/resources/views/emails/defaultTemplate.blade.php b/resources/views/emails/defaultTemplate.blade.php new file mode 100644 index 0000000000..a579c8b0f9 --- /dev/null +++ b/resources/views/emails/defaultTemplate.blade.php @@ -0,0 +1,102 @@ + + + + + + + Invitation Email + + + + + + +
- + Join Now
+ + + + + + + + + [body] + + + + + + + + + +
+ Kanvas Logo +
+ + + + + + + +
+ + + + + + + +
+

+ If you’re having trouble with the button above, copy and paste the URL below into your web browser. +

+
+ + + + + + + + + +
+

+ Copyright © {{date('Y')}} Kanvas, INC. All rights reserved. +

+
+ Kanvas Logo +
+ + + \ No newline at end of file diff --git a/resources/views/emails/passwordUpdated.blade.php b/resources/views/emails/passwordUpdated.blade.php new file mode 100644 index 0000000000..e4e76b5519 --- /dev/null +++ b/resources/views/emails/passwordUpdated.blade.php @@ -0,0 +1,11 @@ + + +

+ Hi {{ $user->firstname }} {{ $user->lastname }}, + + +

+ Your {{ $app->name }} password was successfully updated. +

+ + \ No newline at end of file diff --git a/resources/views/emails/pushNotification.blade.php b/resources/views/emails/pushNotification.blade.php new file mode 100644 index 0000000000..5ff45a5a55 --- /dev/null +++ b/resources/views/emails/pushNotification.blade.php @@ -0,0 +1,5 @@ +{ + "title": "Hello {{$toUser->displayname}}", + "subtitle": "New entity has been created", + "message": "{{$fromUser->displayname}} has created a new entity: {{$entity[\"title\"]}}" +} \ No newline at end of file diff --git a/resources/views/emails/resetPassword.blade.php b/resources/views/emails/resetPassword.blade.php new file mode 100644 index 0000000000..9c10d944b7 --- /dev/null +++ b/resources/views/emails/resetPassword.blade.php @@ -0,0 +1,24 @@ + + +

+ Hi {{ $user->firstname}} {{ $user->lastname}}, + +

+ You recently requested to reset your password for your SalesAssist account. Click the button below to reset it. +

+ + + + + + + + + +
+ + Join Now + +
+ + \ No newline at end of file diff --git a/resources/views/emails/userInvite.blade.php b/resources/views/emails/userInvite.blade.php new file mode 100644 index 0000000000..2c062e93d9 --- /dev/null +++ b/resources/views/emails/userInvite.blade.php @@ -0,0 +1,24 @@ + +

+ Hi {{ $entity->firstname}} {{ $entity->lastname}}, + + +

+ You have been invited to {{ $fromUser->getCurrentBranch()->name}} by {{ $fromUser->firstname}} {{ $fromUser->lastname}}. Please click the button below to create your account. +

+ + + + + + + + + +
+ + Join Now + +
+ + \ No newline at end of file diff --git a/resources/views/emails/welcome.blade.php b/resources/views/emails/welcome.blade.php new file mode 100644 index 0000000000..eaa398a540 --- /dev/null +++ b/resources/views/emails/welcome.blade.php @@ -0,0 +1,11 @@ + + +

+ Hi {{ $user->firstname }} {{ $user->lastname }}, + + +

+ Welcome to {{ $app->name }} . +

+ + \ No newline at end of file diff --git a/src/Kanvas/Apps/Actions/CreateAppsAction.php b/src/Kanvas/Apps/Actions/CreateAppsAction.php index c0477d8c8f..99155376d8 100644 --- a/src/Kanvas/Apps/Actions/CreateAppsAction.php +++ b/src/Kanvas/Apps/Actions/CreateAppsAction.php @@ -5,6 +5,7 @@ namespace Kanvas\Apps\Actions; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\File; use Kanvas\AccessControlList\Actions\CreateRoleAction; use Kanvas\AccessControlList\Enums\RolesEnums; use Kanvas\Apps\DataTransferObject\AppInput; @@ -16,7 +17,6 @@ use Kanvas\SystemModules\Actions\CreateInCurrentAppAction; use Kanvas\Templates\Actions\CreateTemplateAction; use Kanvas\Templates\DataTransferObject\TemplateInput; -use Kanvas\Templates\Repositories\DefaultTemplateRepository; use Kanvas\Users\Models\Users; use Throwable; @@ -189,33 +189,48 @@ public function createEmailTemplate(Apps $app): void $templates = [ [ 'name' => 'Default', - 'template' => DefaultTemplateRepository::getDefaultTemplate(), + 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), ], [ 'name' => 'user-email-update', - 'template' => DefaultTemplateRepository::getDefaultTemplate(), + 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), ], [ 'name' => 'users-invite', - 'template' => DefaultTemplateRepository::getUsersInvite(), + 'template' => File::get(resource_path('views/email/userInvite.blade.php')), ], [ 'name' => 'change-password', - 'template' => DefaultTemplateRepository::getChangePassword(), + 'template' => File::get(resource_path('views/email/passwordUpdated.blade.php')), ], [ 'name' => 'reset-password', - 'template' => DefaultTemplateRepository::getResetPassword(), + 'template' => File::get(resource_path('views/email/resetPassword.blade.php')), ], [ 'name' => 'welcome', - 'template' => DefaultTemplateRepository::getWelcome(), + 'template' => File::get(resource_path('views/email/welcome.blade.php')), ], [ 'name' => 'new-push-default', - 'template' => DefaultTemplateRepository::getNewPushDefault(), + 'template' => File::get(resource_path('views/email/pushNotification.blade.php')), ], ]; + + $dto = new TemplateInput( + $app, + $templates[0]['name'], + $templates[0]['template'], + null, + $this->user + ); + + $action = new CreateTemplateAction($dto); + $parent = $action->execute(); + + //remove first + array_shift($templates); + foreach ($templates as $template) { $dto = new TemplateInput( $app, @@ -224,8 +239,9 @@ public function createEmailTemplate(Apps $app): void null, $this->user ); + $action = new CreateTemplateAction($dto); - $action->execute(); + $parent = $action->execute($template['name'] !== 'user-email-update' ? $parent : null); } } } diff --git a/src/Kanvas/Templates/Actions/CreateTemplateAction.php b/src/Kanvas/Templates/Actions/CreateTemplateAction.php index 4c762de2b9..e225790944 100644 --- a/src/Kanvas/Templates/Actions/CreateTemplateAction.php +++ b/src/Kanvas/Templates/Actions/CreateTemplateAction.php @@ -21,7 +21,7 @@ public function __construct( /** * Invoke function. */ - public function execute(): Templates + public function execute(?Templates $parent = null): Templates { return Templates::firstOrCreate( [ @@ -32,6 +32,7 @@ public function execute(): Templates [ 'users_id' => $this->template->user ? $this->template->user->getKey() : AppEnums::GLOBAL_USER_ID->getValue(), 'template' => $this->template->template, + 'parent_template_id' => $parent ? $parent->getId() : null, ] ); } diff --git a/src/Kanvas/Templates/Repositories/DefaultTemplateRepository.php b/src/Kanvas/Templates/Repositories/DefaultTemplateRepository.php deleted file mode 100644 index 62ae7ab515..0000000000 --- a/src/Kanvas/Templates/Repositories/DefaultTemplateRepository.php +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - Invitation Email - - - - - - ​ - - - - - ​ - - - - ​ - [body] - ​ - - - - ​ - - - - ​ -
- Kanvas Logo -
- - - - - - - -
- - - - - - - -
-

- If you’re having trouble with the button above, copy and paste the URL below into your web browser. -

-
- ​ - - - - - ​ - - - -
-

- Copyright © {{date(\'Y\')}} Kanvas, INC. All rights reserved. -

-
- Kanvas Logo -
- - - '; - } - - public static function getUsersInvite(): string - { - return ' - -

- Hi {{ $entity->firstname}} {{ $entity->lastname}}, - - -

- You have been invited to {{ $fromUser->getCurrentBranch()->name}} by {{ $fromUser->firstname}} {{ $fromUser->lastname}}. Please click the button below to create your account. -

- - - - - - - - - -
- - Join Now - -
- - - '; - } - - public static function getChangePassword(): string - { - return ' - -

- Hi {{ $user->firstname }} {{ $user->lastname }}, - - -

- Your {{ $app->name }} password was successfully updated. -

- - '; - } - - public static function getResetPassword(): string - { - return ' - -

- Hi {{ $user->firstname}} {{ $user->lastname}}, - -

- You recently requested to reset your password for your SalesAssist account. Click the button below to reset it. -

- - - - - - - - - -
- - Join Now - -
- - '; - } - - public static function getWelcome(): string - { - return ' - -

- Hi {{ $user->firstname }} {{ $user->lastname }}, - - -

- Welcome to {{ $app->name }} . -

- - '; - } - - public static function getNewPushDefault(): string - { - return '{ - "title": "Hello {{$toUser->displayname}}", - "subtitle": "New entity has been created", - "message": "{{$fromUser->displayname}} has created a new entity: {{$entity[\"title\"]}}" - }'; - } -} From e46cd9ded4bc000513feb5db592af840ea02c8d6 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 14:36:14 -0400 Subject: [PATCH 40/58] refact: default app email templates --- database/seeders/TemplateSeeder.php | 14 +++++++------- src/Kanvas/Apps/Actions/CreateAppsAction.php | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/database/seeders/TemplateSeeder.php b/database/seeders/TemplateSeeder.php index 4e923ebc21..3526523125 100755 --- a/database/seeders/TemplateSeeder.php +++ b/database/seeders/TemplateSeeder.php @@ -23,7 +23,7 @@ public function run() 'companies_id' => 0, 'parent_template_id' => 0, 'name' => 'Default', - 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -34,7 +34,7 @@ public function run() 'companies_id' => 0, 'parent_template_id' => 0, 'name' => 'user-email-update', - 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -45,7 +45,7 @@ public function run() 'companies_id' => 0, 'name' => 'users-invite', 'parent_template_id' => $defaultTemplate->id, - 'template' => File::get(resource_path('views/email/userInvite.blade.php')), + 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -56,7 +56,7 @@ public function run() 'companies_id' => 0, 'name' => 'change-password', 'parent_template_id' => $defaultTemplate->id, - 'template' => File::get(resource_path('views/email/passwordUpdated.blade.php')), + 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -67,7 +67,7 @@ public function run() 'companies_id' => 0, 'name' => 'reset-password', 'parent_template_id' => $defaultTemplate->id, - 'template' => File::get(resource_path('views/email/resetPassword.blade.php')), + 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -78,7 +78,7 @@ public function run() 'companies_id' => 0, 'name' => 'welcome', 'parent_template_id' => $defaultTemplate->id, - 'template' => File::get(resource_path('views/email/welcome.blade.php')), + 'template' => File::get(resource_path('views/emails/welcome.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -90,7 +90,7 @@ public function run() 'companies_id' => 0, 'name' => 'new-push-default', 'parent_template_id' => 0, - 'template' => File::get(resource_path('views/email/pushNotification.blade.php')), + 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); } diff --git a/src/Kanvas/Apps/Actions/CreateAppsAction.php b/src/Kanvas/Apps/Actions/CreateAppsAction.php index 99155376d8..99d8ae0a9a 100644 --- a/src/Kanvas/Apps/Actions/CreateAppsAction.php +++ b/src/Kanvas/Apps/Actions/CreateAppsAction.php @@ -189,31 +189,31 @@ public function createEmailTemplate(Apps $app): void $templates = [ [ 'name' => 'Default', - 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), ], [ 'name' => 'user-email-update', - 'template' => File::get(resource_path('views/email/defaultTemplate.blade.php')), + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), ], [ 'name' => 'users-invite', - 'template' => File::get(resource_path('views/email/userInvite.blade.php')), + 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), ], [ 'name' => 'change-password', - 'template' => File::get(resource_path('views/email/passwordUpdated.blade.php')), + 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), ], [ 'name' => 'reset-password', - 'template' => File::get(resource_path('views/email/resetPassword.blade.php')), + 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), ], [ 'name' => 'welcome', - 'template' => File::get(resource_path('views/email/welcome.blade.php')), + 'template' => File::get(resource_path('views/emails/welcome.blade.php')), ], [ 'name' => 'new-push-default', - 'template' => File::get(resource_path('views/email/pushNotification.blade.php')), + 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), ], ]; From e0bf1170d49ba3f9d497b64dd919b525bff7c478 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 14:49:24 -0400 Subject: [PATCH 41/58] refact: default app email templates --- src/Kanvas/Templates/Actions/CreateTemplateAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kanvas/Templates/Actions/CreateTemplateAction.php b/src/Kanvas/Templates/Actions/CreateTemplateAction.php index e225790944..287f35d69b 100644 --- a/src/Kanvas/Templates/Actions/CreateTemplateAction.php +++ b/src/Kanvas/Templates/Actions/CreateTemplateAction.php @@ -32,7 +32,7 @@ public function execute(?Templates $parent = null): Templates [ 'users_id' => $this->template->user ? $this->template->user->getKey() : AppEnums::GLOBAL_USER_ID->getValue(), 'template' => $this->template->template, - 'parent_template_id' => $parent ? $parent->getId() : null, + 'parent_template_id' => $parent ? $parent->getId() : 0, ] ); } From fa28d59f02db0aaf1faa1ae1e7111c63c05d946b Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 15:22:52 -0400 Subject: [PATCH 42/58] refact: default app email templates --- src/Kanvas/Apps/Actions/CreateAppsAction.php | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Kanvas/Apps/Actions/CreateAppsAction.php b/src/Kanvas/Apps/Actions/CreateAppsAction.php index 99d8ae0a9a..760b5a9bbd 100644 --- a/src/Kanvas/Apps/Actions/CreateAppsAction.php +++ b/src/Kanvas/Apps/Actions/CreateAppsAction.php @@ -4,6 +4,7 @@ namespace Kanvas\Apps\Actions; +use Baka\Support\Str; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; use Kanvas\AccessControlList\Actions\CreateRoleAction; @@ -13,8 +14,14 @@ use Kanvas\Apps\Jobs\CreateSystemModuleJob; use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; +use Kanvas\Notifications\Models\NotificationTypes; +use Kanvas\Notifications\Templates\ChangePasswordUserLogged; +use Kanvas\Notifications\Templates\Invite; +use Kanvas\Notifications\Templates\ResetPassword; +use Kanvas\Notifications\Templates\Welcome; use Kanvas\Roles\Models\Roles; use Kanvas\SystemModules\Actions\CreateInCurrentAppAction; +use Kanvas\SystemModules\Repositories\SystemModulesRepository; use Kanvas\Templates\Actions\CreateTemplateAction; use Kanvas\Templates\DataTransferObject\TemplateInput; use Kanvas\Users\Models\Users; @@ -68,6 +75,7 @@ public function execute(): Apps //@todo $this->createEmailTemplate($app); + $this->createNotificationTypes($app); }); return $app; @@ -185,7 +193,6 @@ public function acl(Apps $app): void public function createEmailTemplate(Apps $app): void { - // @todo $templates = [ [ 'name' => 'Default', @@ -244,4 +251,26 @@ public function createEmailTemplate(Apps $app): void $parent = $action->execute($template['name'] !== 'user-email-update' ? $parent : null); } } + + public function createNotificationTypes(Apps $app): void + { + $types = [ + 'users-invite' => Invite::class, + 'reset-password' => ResetPassword::class, + 'welcome' => Welcome::class, + 'change-password' => ChangePasswordUserLogged::class, + ]; + + foreach ($types as $type => $value) { + NotificationTypes::firstOrCreate([ + 'apps_id' => $app->getId(), + 'key' => $value, + 'name' => Str::simpleSlug($value), + 'system_modules_id' => SystemModulesRepository::getByModelName($value, $app)->getId(), + 'is_deleted' => 0, + ], [ + 'template' => $type, + ]); + } + } } From 5555a5de5bbf5cd2272f442c5a9e9be893e50425 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 15:37:42 -0400 Subject: [PATCH 43/58] refact: add enums --- database/seeders/TemplateSeeder.php | 14 +++++++----- src/Kanvas/Apps/Actions/CreateAppsAction.php | 22 ++++++++++--------- .../Templates/ChangePasswordUserLogged.php | 3 ++- src/Kanvas/Notifications/Templates/Invite.php | 3 ++- .../Notifications/Templates/ResetPassword.php | 3 ++- .../Notifications/Templates/Welcome.php | 3 ++- .../Templates/Enums/EmailTemplateEnum.php | 14 ++++++++++++ .../Enums/PushNotificationTemplateEnum.php | 10 +++++++++ 8 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 src/Kanvas/Templates/Enums/EmailTemplateEnum.php create mode 100644 src/Kanvas/Templates/Enums/PushNotificationTemplateEnum.php diff --git a/database/seeders/TemplateSeeder.php b/database/seeders/TemplateSeeder.php index 3526523125..1343ffb899 100755 --- a/database/seeders/TemplateSeeder.php +++ b/database/seeders/TemplateSeeder.php @@ -4,6 +4,8 @@ use Illuminate\Database\Seeder; use Illuminate\Support\Facades\File; +use Kanvas\Templates\Enums\EmailTemplateEnum; +use Kanvas\Templates\Enums\PushNotificationTemplateEnum; use Kanvas\Templates\Models\Templates; class TemplateSeeder extends Seeder @@ -22,7 +24,7 @@ public function run() 'users_id' => 1, 'companies_id' => 0, 'parent_template_id' => 0, - 'name' => 'Default', + 'name' => EmailTemplateEnum::DEFAULT->value, 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), 'created_at' => date('Y-m-d H:i:s'), ]); @@ -43,7 +45,7 @@ public function run() 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, - 'name' => 'users-invite', + 'name' => EmailTemplateEnum::USER_INVITE->value, 'parent_template_id' => $defaultTemplate->id, 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), 'created_at' => date('Y-m-d H:i:s'), @@ -54,7 +56,7 @@ public function run() 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, - 'name' => 'change-password', + 'name' => EmailTemplateEnum::CHANGE_PASSWORD->value, 'parent_template_id' => $defaultTemplate->id, 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), 'created_at' => date('Y-m-d H:i:s'), @@ -65,7 +67,7 @@ public function run() 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, - 'name' => 'reset-password', + 'name' => EmailTemplateEnum::RESET_PASSWORD->value, 'parent_template_id' => $defaultTemplate->id, 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), 'created_at' => date('Y-m-d H:i:s'), @@ -76,7 +78,7 @@ public function run() 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, - 'name' => 'welcome', + 'name' => EmailTemplateEnum::WELCOME->value, 'parent_template_id' => $defaultTemplate->id, 'template' => File::get(resource_path('views/emails/welcome.blade.php')), 'created_at' => date('Y-m-d H:i:s'), @@ -88,7 +90,7 @@ public function run() 'apps_id' => 0, 'users_id' => 1, 'companies_id' => 0, - 'name' => 'new-push-default', + 'name' => PushNotificationTemplateEnum::DEFAULT->value, 'parent_template_id' => 0, 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), 'created_at' => date('Y-m-d H:i:s'), diff --git a/src/Kanvas/Apps/Actions/CreateAppsAction.php b/src/Kanvas/Apps/Actions/CreateAppsAction.php index 760b5a9bbd..ec6bfa8622 100644 --- a/src/Kanvas/Apps/Actions/CreateAppsAction.php +++ b/src/Kanvas/Apps/Actions/CreateAppsAction.php @@ -24,6 +24,8 @@ use Kanvas\SystemModules\Repositories\SystemModulesRepository; use Kanvas\Templates\Actions\CreateTemplateAction; use Kanvas\Templates\DataTransferObject\TemplateInput; +use Kanvas\Templates\Enums\EmailTemplateEnum; +use Kanvas\Templates\Enums\PushNotificationTemplateEnum; use Kanvas\Users\Models\Users; use Throwable; @@ -195,7 +197,7 @@ public function createEmailTemplate(Apps $app): void { $templates = [ [ - 'name' => 'Default', + 'name' => EmailTemplateEnum::DEFAULT->value, 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), ], [ @@ -203,23 +205,23 @@ public function createEmailTemplate(Apps $app): void 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), ], [ - 'name' => 'users-invite', + 'name' => EmailTemplateEnum::USER_INVITE->value, 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), ], [ - 'name' => 'change-password', + 'name' => EmailTemplateEnum::CHANGE_PASSWORD->value, 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), ], [ - 'name' => 'reset-password', + 'name' => EmailTemplateEnum::RESET_PASSWORD->value, 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), ], [ - 'name' => 'welcome', + 'name' => EmailTemplateEnum::WELCOME->value, 'template' => File::get(resource_path('views/emails/welcome.blade.php')), ], [ - 'name' => 'new-push-default', + 'name' => PushNotificationTemplateEnum::DEFAULT->value, 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), ], ]; @@ -255,10 +257,10 @@ public function createEmailTemplate(Apps $app): void public function createNotificationTypes(Apps $app): void { $types = [ - 'users-invite' => Invite::class, - 'reset-password' => ResetPassword::class, - 'welcome' => Welcome::class, - 'change-password' => ChangePasswordUserLogged::class, + EmailTemplateEnum::USER_INVITE->value => Invite::class, + EmailTemplateEnum::RESET_PASSWORD->value => ResetPassword::class, + EmailTemplateEnum::WELCOME->value => Welcome::class, + EmailTemplateEnum::CHANGE_PASSWORD->value => ChangePasswordUserLogged::class, ]; foreach ($types as $type => $value) { diff --git a/src/Kanvas/Notifications/Templates/ChangePasswordUserLogged.php b/src/Kanvas/Notifications/Templates/ChangePasswordUserLogged.php index 8bbefb8c07..ad8e202755 100644 --- a/src/Kanvas/Notifications/Templates/ChangePasswordUserLogged.php +++ b/src/Kanvas/Notifications/Templates/ChangePasswordUserLogged.php @@ -5,8 +5,9 @@ namespace Kanvas\Notifications\Templates; use Kanvas\Notifications\Notification; +use Kanvas\Templates\Enums\EmailTemplateEnum; class ChangePasswordUserLogged extends Notification { - public ?string $templateName = 'change-password'; + public ?string $templateName = EmailTemplateEnum::CHANGE_PASSWORD->value; } diff --git a/src/Kanvas/Notifications/Templates/Invite.php b/src/Kanvas/Notifications/Templates/Invite.php index ce2b81577f..6a750ce6c7 100644 --- a/src/Kanvas/Notifications/Templates/Invite.php +++ b/src/Kanvas/Notifications/Templates/Invite.php @@ -5,10 +5,11 @@ namespace Kanvas\Notifications\Templates; use Kanvas\Notifications\Notification; +use Kanvas\Templates\Enums\EmailTemplateEnum; class Invite extends Notification { - public ?string $templateName = 'users-invite'; + public ?string $templateName = EmailTemplateEnum::USER_INVITE->value; public function getData(): array { diff --git a/src/Kanvas/Notifications/Templates/ResetPassword.php b/src/Kanvas/Notifications/Templates/ResetPassword.php index 7a97f7309c..82cdc10df9 100644 --- a/src/Kanvas/Notifications/Templates/ResetPassword.php +++ b/src/Kanvas/Notifications/Templates/ResetPassword.php @@ -4,13 +4,14 @@ use Kanvas\Enums\AppSettingsEnums; use Kanvas\Notifications\Notification; +use Kanvas\Templates\Enums\EmailTemplateEnum; /** * @deprecated version 2 , move to DynamicKanvasNotification */ class ResetPassword extends Notification { - public ?string $templateName = 'reset-password'; + public ?string $templateName = EmailTemplateEnum::RESET_PASSWORD->value; public function getData(): array { diff --git a/src/Kanvas/Notifications/Templates/Welcome.php b/src/Kanvas/Notifications/Templates/Welcome.php index 5b519c87e2..316c694f01 100644 --- a/src/Kanvas/Notifications/Templates/Welcome.php +++ b/src/Kanvas/Notifications/Templates/Welcome.php @@ -3,8 +3,9 @@ namespace Kanvas\Notifications\Templates; use Kanvas\Notifications\Notification; +use Kanvas\Templates\Enums\EmailTemplateEnum; class Welcome extends Notification { - public ?string $templateName = 'welcome'; + public ?string $templateName = EmailTemplateEnum::WELCOME->value; } diff --git a/src/Kanvas/Templates/Enums/EmailTemplateEnum.php b/src/Kanvas/Templates/Enums/EmailTemplateEnum.php new file mode 100644 index 0000000000..292aab6a6e --- /dev/null +++ b/src/Kanvas/Templates/Enums/EmailTemplateEnum.php @@ -0,0 +1,14 @@ + Date: Sat, 22 Jun 2024 17:21:34 -0400 Subject: [PATCH 44/58] refact: add sync action and command --- app/Console/Commands/KanvasFixCommand.php | 75 +++++++++++ src/Kanvas/Apps/Actions/CreateAppsAction.php | 99 +-------------- .../Apps/Actions/SyncEmailTemplateAction.php | 118 ++++++++++++++++++ .../Actions/CreateTemplateAction.php | 2 +- 4 files changed, 196 insertions(+), 98 deletions(-) create mode 100644 app/Console/Commands/KanvasFixCommand.php create mode 100644 src/Kanvas/Apps/Actions/SyncEmailTemplateAction.php diff --git a/app/Console/Commands/KanvasFixCommand.php b/app/Console/Commands/KanvasFixCommand.php new file mode 100644 index 0000000000..6d8766072f --- /dev/null +++ b/app/Console/Commands/KanvasFixCommand.php @@ -0,0 +1,75 @@ +argument('app_id'); + $app = Apps::getById($appId); + $user = Users::getById($this->argument('user_id')); + + if (! $app) { + $this->error("App with ID $appId not found."); + + return 1; + } + + $this->info("Sync email templates from the app: {$app->name}"); + $this->newLine(); + + $defaultTemplate = Templates::notDeleted()->fromApp($app)->where('parent_template_id', 0)->first(); + + if (! $defaultTemplate) { + $this->error('Default template not found.'); + $this->syncTemplates($app, $user); + + return 1; + } + + if ($this->confirm('Do you want to sync the email templates? This will overwrite the existing email templates.')) { + $this->syncTemplates($app, $user); + $this->info('Email templates have been synced.'); + } else { + $this->info('Email templates syncing has been canceled.'); + } + + return 0; + } + + /** + * Sync the email templates. + */ + protected function syncTemplates(Apps $app, UserInterface $user): void + { + $syncEmailTemplate = new SyncEmailTemplateAction($app, $user); + $syncEmailTemplate->execute(); + } +} diff --git a/src/Kanvas/Apps/Actions/CreateAppsAction.php b/src/Kanvas/Apps/Actions/CreateAppsAction.php index ec6bfa8622..2af45b7a23 100644 --- a/src/Kanvas/Apps/Actions/CreateAppsAction.php +++ b/src/Kanvas/Apps/Actions/CreateAppsAction.php @@ -4,9 +4,7 @@ namespace Kanvas\Apps\Actions; -use Baka\Support\Str; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\File; use Kanvas\AccessControlList\Actions\CreateRoleAction; use Kanvas\AccessControlList\Enums\RolesEnums; use Kanvas\Apps\DataTransferObject\AppInput; @@ -14,18 +12,8 @@ use Kanvas\Apps\Jobs\CreateSystemModuleJob; use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; -use Kanvas\Notifications\Models\NotificationTypes; -use Kanvas\Notifications\Templates\ChangePasswordUserLogged; -use Kanvas\Notifications\Templates\Invite; -use Kanvas\Notifications\Templates\ResetPassword; -use Kanvas\Notifications\Templates\Welcome; use Kanvas\Roles\Models\Roles; use Kanvas\SystemModules\Actions\CreateInCurrentAppAction; -use Kanvas\SystemModules\Repositories\SystemModulesRepository; -use Kanvas\Templates\Actions\CreateTemplateAction; -use Kanvas\Templates\DataTransferObject\TemplateInput; -use Kanvas\Templates\Enums\EmailTemplateEnum; -use Kanvas\Templates\Enums\PushNotificationTemplateEnum; use Kanvas\Users\Models\Users; use Throwable; @@ -76,8 +64,8 @@ public function execute(): Apps $this->user->assign(RolesEnums::OWNER->value); //@todo - $this->createEmailTemplate($app); - $this->createNotificationTypes($app); + $syncEmailTemplate = new SyncEmailTemplateAction($app, $this->user); + $syncEmailTemplate->execute(); }); return $app; @@ -192,87 +180,4 @@ public function acl(Apps $app): void $newRole->execute(); } } - - public function createEmailTemplate(Apps $app): void - { - $templates = [ - [ - 'name' => EmailTemplateEnum::DEFAULT->value, - 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), - ], - [ - 'name' => 'user-email-update', - 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), - ], - [ - 'name' => EmailTemplateEnum::USER_INVITE->value, - 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), - ], - [ - 'name' => EmailTemplateEnum::CHANGE_PASSWORD->value, - 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), - ], - [ - 'name' => EmailTemplateEnum::RESET_PASSWORD->value, - 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), - ], - [ - 'name' => EmailTemplateEnum::WELCOME->value, - 'template' => File::get(resource_path('views/emails/welcome.blade.php')), - ], - [ - 'name' => PushNotificationTemplateEnum::DEFAULT->value, - 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), - ], - ]; - - $dto = new TemplateInput( - $app, - $templates[0]['name'], - $templates[0]['template'], - null, - $this->user - ); - - $action = new CreateTemplateAction($dto); - $parent = $action->execute(); - - //remove first - array_shift($templates); - - foreach ($templates as $template) { - $dto = new TemplateInput( - $app, - $template['name'], - $template['template'], - null, - $this->user - ); - - $action = new CreateTemplateAction($dto); - $parent = $action->execute($template['name'] !== 'user-email-update' ? $parent : null); - } - } - - public function createNotificationTypes(Apps $app): void - { - $types = [ - EmailTemplateEnum::USER_INVITE->value => Invite::class, - EmailTemplateEnum::RESET_PASSWORD->value => ResetPassword::class, - EmailTemplateEnum::WELCOME->value => Welcome::class, - EmailTemplateEnum::CHANGE_PASSWORD->value => ChangePasswordUserLogged::class, - ]; - - foreach ($types as $type => $value) { - NotificationTypes::firstOrCreate([ - 'apps_id' => $app->getId(), - 'key' => $value, - 'name' => Str::simpleSlug($value), - 'system_modules_id' => SystemModulesRepository::getByModelName($value, $app)->getId(), - 'is_deleted' => 0, - ], [ - 'template' => $type, - ]); - } - } } diff --git a/src/Kanvas/Apps/Actions/SyncEmailTemplateAction.php b/src/Kanvas/Apps/Actions/SyncEmailTemplateAction.php new file mode 100644 index 0000000000..5628e7cf32 --- /dev/null +++ b/src/Kanvas/Apps/Actions/SyncEmailTemplateAction.php @@ -0,0 +1,118 @@ +createEmailTemplate(); + $this->createNotificationTypes(); + } + + public function createEmailTemplate(): void + { + $templates = [ + [ + 'name' => EmailTemplateEnum::DEFAULT->value, + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), + ], + [ + 'name' => 'user-email-update', + 'template' => File::get(resource_path('views/emails/defaultTemplate.blade.php')), + ], + [ + 'name' => EmailTemplateEnum::USER_INVITE->value, + 'template' => File::get(resource_path('views/emails/userInvite.blade.php')), + ], + [ + 'name' => EmailTemplateEnum::CHANGE_PASSWORD->value, + 'template' => File::get(resource_path('views/emails/passwordUpdated.blade.php')), + ], + [ + 'name' => EmailTemplateEnum::RESET_PASSWORD->value, + 'template' => File::get(resource_path('views/emails/resetPassword.blade.php')), + ], + [ + 'name' => EmailTemplateEnum::WELCOME->value, + 'template' => File::get(resource_path('views/emails/welcome.blade.php')), + ], + [ + 'name' => PushNotificationTemplateEnum::DEFAULT->value, + 'template' => File::get(resource_path('views/emails/pushNotification.blade.php')), + ], + ]; + + $dto = new TemplateInput( + $this->app, + $templates[0]['name'], + $templates[0]['template'], + null, + $this->user + ); + + $action = new CreateTemplateAction($dto); + $parent = $action->execute(); + + //remove first + array_shift($templates); + + foreach ($templates as $template) { + $dto = new TemplateInput( + $this->app, + $template['name'], + $template['template'], + null, + $this->user + ); + + $action = new CreateTemplateAction($dto); + $action->execute(! in_array($template['name'], [PushNotificationTemplateEnum::DEFAULT->value, 'user-email-update']) ? $parent : null); + } + } + + public function createNotificationTypes(): void + { + $types = [ + EmailTemplateEnum::USER_INVITE->value => Invite::class, + EmailTemplateEnum::RESET_PASSWORD->value => ResetPassword::class, + EmailTemplateEnum::WELCOME->value => Welcome::class, + EmailTemplateEnum::CHANGE_PASSWORD->value => ChangePasswordUserLogged::class, + ]; + + foreach ($types as $type => $value) { + NotificationTypes::updateOrCreate([ + 'apps_id' => $this->app->getId(), + 'key' => $value, + 'name' => Str::simpleSlug($value), + 'system_modules_id' => SystemModulesRepository::getByModelName($value, $this->app)->getId(), + 'is_deleted' => 0, + ], [ + 'template' => $type, + ]); + } + } +} diff --git a/src/Kanvas/Templates/Actions/CreateTemplateAction.php b/src/Kanvas/Templates/Actions/CreateTemplateAction.php index 287f35d69b..574ee21172 100644 --- a/src/Kanvas/Templates/Actions/CreateTemplateAction.php +++ b/src/Kanvas/Templates/Actions/CreateTemplateAction.php @@ -23,7 +23,7 @@ public function __construct( */ public function execute(?Templates $parent = null): Templates { - return Templates::firstOrCreate( + return Templates::updateOrCreate( [ 'apps_id' => $this->template->app->getKey(), 'companies_id' => $this->template->company ? $this->template->company->getKey() : AppEnums::GLOBAL_COMPANY_ID->getValue(), From 41e07d780d16ef77abadf9bade1fb53002e72142 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 17:23:51 -0400 Subject: [PATCH 45/58] refact: add sync action and command --- .../{KanvasFixCommand.php => KanvasEmailTemplateSync.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/Console/Commands/{KanvasFixCommand.php => KanvasEmailTemplateSync.php} (97%) diff --git a/app/Console/Commands/KanvasFixCommand.php b/app/Console/Commands/KanvasEmailTemplateSync.php similarity index 97% rename from app/Console/Commands/KanvasFixCommand.php rename to app/Console/Commands/KanvasEmailTemplateSync.php index 6d8766072f..68aa5141d8 100644 --- a/app/Console/Commands/KanvasFixCommand.php +++ b/app/Console/Commands/KanvasEmailTemplateSync.php @@ -11,7 +11,7 @@ use Kanvas\Templates\Models\Templates; use Kanvas\Users\Models\Users; -class KanvasVersionCommand extends Command +class KanvasEmailTemplateSync extends Command { /** * The name and signature of the console command. From ef635fa8defb6254e2fa6b633d6e69dff43d0b81 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 18:58:43 -0400 Subject: [PATCH 46/58] feat: allow app global images --- .../Queries/Filesystem/FilesystemQuery.php | 5 +++-- src/Kanvas/Enums/AppSettingsEnums.php | 2 ++ .../SystemModules/Models/SystemModules.php | 21 ++----------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/app/GraphQL/Ecosystem/Queries/Filesystem/FilesystemQuery.php b/app/GraphQL/Ecosystem/Queries/Filesystem/FilesystemQuery.php index 9058b47869..6d8568553b 100644 --- a/app/GraphQL/Ecosystem/Queries/Filesystem/FilesystemQuery.php +++ b/app/GraphQL/Ecosystem/Queries/Filesystem/FilesystemQuery.php @@ -7,6 +7,7 @@ use Baka\Enums\StateEnums; use GraphQL\Type\Definition\ResolveInfo; use Illuminate\Database\Eloquent\Builder; +use Kanvas\Enums\AppSettingsEnums; use Kanvas\Filesystem\Models\Filesystem; use Kanvas\SystemModules\DataTransferObject\SystemModuleEntityInput; use Kanvas\SystemModules\Repositories\SystemModulesRepository; @@ -24,6 +25,7 @@ public function getFileByGraphType( ResolveInfo $resolveInfo ): Builder { $systemModule = SystemModulesRepository::getByModelName($root::class); + $app = $systemModule->app; /** * @var Builder @@ -44,8 +46,7 @@ public function getFileByGraphType( ->where('filesystem_entities.is_deleted', '=', StateEnums::NO->getValue()) ->where('filesystem.is_deleted', '=', StateEnums::NO->getValue()); - //@todo allow to share media between company only of it the apps specifies it - $files->when(isset($root->companies_id), function ($query) use ($root) { + $files->when(isset($root->companies_id) && ! $app->get(AppSettingsEnums::GLOBAL_APP_IMAGES->getValue()), function ($query) use ($root) { $query->where('filesystem_entities.companies_id', $root->companies_id); }); diff --git a/src/Kanvas/Enums/AppSettingsEnums.php b/src/Kanvas/Enums/AppSettingsEnums.php index 800c30e09f..a1d72f493f 100644 --- a/src/Kanvas/Enums/AppSettingsEnums.php +++ b/src/Kanvas/Enums/AppSettingsEnums.php @@ -17,6 +17,7 @@ enum AppSettingsEnums implements EnumsInterface case ONBOARDING_INVENTORY_SETUP; case ADMIN_USER_REGISTRATION_ASSIGN_CURRENT_COMPANY; case GLOBAL_USER_REGISTRATION_ASSIGN_GLOBAL_COMPANY; + case GLOBAL_APP_IMAGES; case ONE_SIGNAL_APP_ID; case ONE_SIGNAL_REST_API_KEY; case PASSWORD_STRENGTH; @@ -42,6 +43,7 @@ public function getValue(): mixed self::ONBOARDING_INVENTORY_SETUP => 'onboarding_inventory_setup', self::ADMIN_USER_REGISTRATION_ASSIGN_CURRENT_COMPANY => 'admin_user_registration_assign_current_company', self::GLOBAL_USER_REGISTRATION_ASSIGN_GLOBAL_COMPANY => 'global_user_registration_assign_global_company', + self::GLOBAL_APP_IMAGES => 'global_app_images', self::ONE_SIGNAL_APP_ID => 'one_signal_app_id', self::ONE_SIGNAL_REST_API_KEY => 'one_signal_rest_api_key', self::PASSWORD_STRENGTH => 'flag_password_strength', diff --git a/src/Kanvas/SystemModules/Models/SystemModules.php b/src/Kanvas/SystemModules/Models/SystemModules.php index a45e2f929f..6bff9513d8 100644 --- a/src/Kanvas/SystemModules/Models/SystemModules.php +++ b/src/Kanvas/SystemModules/Models/SystemModules.php @@ -6,12 +6,12 @@ use Baka\Support\Str; use Baka\Traits\SlugTrait; +use Baka\Traits\UuidTrait; use GeneaLabs\LaravelModelCaching\Traits\Cachable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Kanvas\Apps\Models\Apps; use Kanvas\Models\BaseModel; -use Baka\Traits\UuidTrait; /** * SystemModules Model. @@ -37,18 +37,9 @@ class SystemModules extends BaseModel use SlugTrait; use Cachable; use UuidTrait; - /** - * The table associated with the model. - * - * @var string - */ + protected $table = 'system_modules'; - /** - * cast field. - * - * @var array - */ protected $casts = [ 'browse_fields' => 'array', ]; @@ -73,14 +64,6 @@ public static function bootSlugTrait() }); } - /** - * Apps relationship. - */ - public function app(): BelongsTo - { - return $this->belongsTo(Apps::class, 'apps_id'); - } - /** * Apps relationship. */ From a022aa5f3ff0092d66bf6314a67c598794670bc3 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 22 Jun 2024 19:38:17 -0400 Subject: [PATCH 47/58] feat: allow app global images --- app/Console/Commands/KanvasAppCreateKeyCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/KanvasAppCreateKeyCommand.php b/app/Console/Commands/KanvasAppCreateKeyCommand.php index fbf32f04c6..7ab7a67bb0 100644 --- a/app/Console/Commands/KanvasAppCreateKeyCommand.php +++ b/app/Console/Commands/KanvasAppCreateKeyCommand.php @@ -18,7 +18,7 @@ class KanvasAppCreateKeyCommand extends Command * * @var string */ - protected $signature = 'kanvas:app-key {name} {app_uuid} {email}'; + protected $signature = 'kanvas:app-key {name} {app_id} {email}'; /** * The console command description. @@ -36,9 +36,9 @@ public function handle() { $name = $this->argument('name'); $email = $this->argument('email'); - $appUid = $this->argument('app_uuid'); + $appId = $this->argument('app_id'); - $app = Apps::getByUuid($appUid); + $app = Apps::getById($appId); $user = Users::getByEmail($email); UsersRepository::belongsToThisApp($user, $app); From 662c9a60b699f10e3c9d5dd5a8b79abf226f17c4 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 14:04:11 -0400 Subject: [PATCH 48/58] refact: allow json attribute --- .../Inventory/Attributes/Models/Attributes.php | 15 ++++----------- .../Products/Actions/AddAttributeAction.php | 4 ++-- .../Products/Models/ProductsAttributes.php | 3 ++- .../Variants/Actions/AddAttributeAction.php | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/Domains/Inventory/Attributes/Models/Attributes.php b/src/Domains/Inventory/Attributes/Models/Attributes.php index 644a778764..61db806a6f 100644 --- a/src/Domains/Inventory/Attributes/Models/Attributes.php +++ b/src/Domains/Inventory/Attributes/Models/Attributes.php @@ -4,6 +4,8 @@ namespace Kanvas\Inventory\Attributes\Models; +use Baka\Support\Str; +use Baka\Traits\DatabaseSearchableTrait; use Baka\Traits\UuidTrait; use Dyrynda\Database\Support\CascadeSoftDeletes; use Illuminate\Database\Eloquent\Casts\Attribute; @@ -12,7 +14,6 @@ use Kanvas\Apps\Models\Apps; use Kanvas\Companies\Models\Companies; use Kanvas\Inventory\Models\BaseModel; -use Baka\Traits\DatabaseSearchableTrait; use Kanvas\Inventory\Variants\Models\VariantsAttributes; /** @@ -34,14 +35,6 @@ class Attributes extends BaseModel public $guarded = []; protected $cascadeDeletes = ['variantAttributes', 'defaultValues']; - /** - * companies. - */ - public function companies(): BelongsTo - { - return $this->belongsTo(Companies::class, 'companies_id'); - } - /** * apps. */ @@ -56,12 +49,12 @@ public function variantAttributes(): HasMany } /** - * attributes values + * attributes values from pivot */ public function value(): Attribute { return Attribute::make( - get: fn () => $this->pivot->value, + get: fn () => Str::isJson($this->pivot->value) ? json_decode($this->pivot->value, true) : $this->pivot->value, ); } diff --git a/src/Domains/Inventory/Products/Actions/AddAttributeAction.php b/src/Domains/Inventory/Products/Actions/AddAttributeAction.php index a2925a4ba3..048261846e 100644 --- a/src/Domains/Inventory/Products/Actions/AddAttributeAction.php +++ b/src/Domains/Inventory/Products/Actions/AddAttributeAction.php @@ -30,9 +30,9 @@ public function execute(): Products return $this->product; } if ($this->product->attributes()->find($this->attribute->getId())) { - $this->product->attributes()->syncWithoutDetaching([$this->attribute->getId() => ['value' => $this->value]]); + $this->product->attributes()->syncWithoutDetaching([$this->attribute->getId() => ['value' => is_array($this->value) ? json_encode($this->value) : $this->value]]); } else { - $this->product->attributes()->attach($this->attribute->getId(), ['value' => $this->value]); + $this->product->attributes()->attach($this->attribute->getId(), ['value' => is_array($this->value) ? json_encode($this->value) : $this->value]); } return $this->product; diff --git a/src/Domains/Inventory/Products/Models/ProductsAttributes.php b/src/Domains/Inventory/Products/Models/ProductsAttributes.php index 08ddddd206..5a310e1680 100644 --- a/src/Domains/Inventory/Products/Models/ProductsAttributes.php +++ b/src/Domains/Inventory/Products/Models/ProductsAttributes.php @@ -4,6 +4,7 @@ namespace Kanvas\Inventory\Products\Models; +use Baka\Casts\Json; use Baka\Traits\HasCompositePrimaryKeyTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Kanvas\Inventory\Attributes\Models\Attributes; @@ -31,7 +32,7 @@ class ProductsAttributes extends BaseModel ]; protected $casts = [ - 'value' => 'array' + 'value' => Json::class ]; protected $primaryKey = ['products_id', 'attributes_id']; diff --git a/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php b/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php index ca2d4336ab..aa4f9a1b8c 100644 --- a/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php +++ b/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php @@ -27,12 +27,12 @@ public function execute(): Variants if ($this->variants->attributes()->find($this->attributes->getId())) { $this->variants->attributes()->syncWithoutDetaching( - [$this->attributes->getId() => ['value' => $this->value]] + [$this->attributes->getId() => ['value' => is_array($this->value) ? json_encode($this->value) : $this->value]] ); } else { $this->variants->attributes()->attach( $this->attributes->getId(), - ['value' => $this->value] + ['value' => is_array($this->value) ? json_encode($this->value) : $this->valuek] ); } From 5d2862f0b1c04b79e44d1adb8ab16a65b7dbde81 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 14:08:26 -0400 Subject: [PATCH 49/58] refact: fix variable --- src/Domains/Inventory/Variants/Actions/AddAttributeAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php b/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php index aa4f9a1b8c..8b16f4c551 100644 --- a/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php +++ b/src/Domains/Inventory/Variants/Actions/AddAttributeAction.php @@ -32,7 +32,7 @@ public function execute(): Variants } else { $this->variants->attributes()->attach( $this->attributes->getId(), - ['value' => is_array($this->value) ? json_encode($this->value) : $this->valuek] + ['value' => is_array($this->value) ? json_encode($this->value) : $this->value] ); } From 703f57479293fcc9be31d111c4d884e2aefd4366 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 18:55:13 -0400 Subject: [PATCH 50/58] refact: specify index by app --- .vscode/settings.json | 1 + src/Domains/Inventory/Products/Models/Products.php | 4 +++- src/Domains/Inventory/Variants/Models/Variants.php | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index fb77aba189..987f1cdc0b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "cSpell.words": [ "hashtable", + "indice", "Meili", "Nuwave" ] diff --git a/src/Domains/Inventory/Products/Models/Products.php b/src/Domains/Inventory/Products/Models/Products.php index b147782e9b..7abe3bb11d 100644 --- a/src/Domains/Inventory/Products/Models/Products.php +++ b/src/Domains/Inventory/Products/Models/Products.php @@ -195,7 +195,9 @@ public function toSearchableArray(): array public function searchableAs(): string { - return config('scout.prefix') . 'product_index'; + $indice = config('scout.prefix') . ($this->app->get('app_custom_product_indice') ?? 'product_index'); + + return $indice; } public static function search($query = '', $callback = null) diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index 6695be94c1..d5c067732a 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -308,7 +308,9 @@ public function toSearchableArray(): array public function searchableAs(): string { - return config('scout.prefix') . 'product_variant_index'; + $indice = config('scout.prefix') . ($this->app->get('app_custom_product_variant_indice') ?? 'product_variant_index'); + + return $indice; } public static function search($query = '', $callback = null) From ba6a63715eb44a80eb92b408d32deaa5852844e3 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 18:56:22 -0400 Subject: [PATCH 51/58] refact: specify app index --- src/Domains/Inventory/Products/Models/Products.php | 4 +--- src/Domains/Inventory/Variants/Models/Variants.php | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Domains/Inventory/Products/Models/Products.php b/src/Domains/Inventory/Products/Models/Products.php index 7abe3bb11d..50fa705ae2 100644 --- a/src/Domains/Inventory/Products/Models/Products.php +++ b/src/Domains/Inventory/Products/Models/Products.php @@ -195,9 +195,7 @@ public function toSearchableArray(): array public function searchableAs(): string { - $indice = config('scout.prefix') . ($this->app->get('app_custom_product_indice') ?? 'product_index'); - - return $indice; + return config('scout.prefix') . ($this->app->get('app_custom_product_index') ?? 'product_index'); } public static function search($query = '', $callback = null) diff --git a/src/Domains/Inventory/Variants/Models/Variants.php b/src/Domains/Inventory/Variants/Models/Variants.php index d5c067732a..f9781a01c4 100644 --- a/src/Domains/Inventory/Variants/Models/Variants.php +++ b/src/Domains/Inventory/Variants/Models/Variants.php @@ -308,9 +308,7 @@ public function toSearchableArray(): array public function searchableAs(): string { - $indice = config('scout.prefix') . ($this->app->get('app_custom_product_variant_indice') ?? 'product_variant_index'); - - return $indice; + return config('scout.prefix') . ($this->app->get('app_custom_product_variant_index') ?? 'product_variant_index'); } public static function search($query = '', $callback = null) From 20ac61ddc87f0bed84569a8fe97f3f49086200b0 Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 21:46:05 -0400 Subject: [PATCH 52/58] refact: fix company users and branch --- .../Queries/Companies/UserManagementQuery.php | 59 ++++++++++++------- graphql/schemas/Ecosystem/company.graphql | 49 ++++++--------- 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php index 4f00f40064..20c307723c 100644 --- a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php +++ b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php @@ -7,7 +7,7 @@ use Baka\Enums\StateEnums; use GraphQL\Type\Definition\ResolveInfo; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Support\Facades\DB; +use Kanvas\Apps\Models\Apps; use Kanvas\Users\Models\Users; use Nuwave\Lighthouse\Support\Contracts\GraphQLContext; @@ -19,25 +19,27 @@ class UserManagementQuery public function getAllCompanyUsers(mixed $root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): Builder { $companiesId = auth()->user()->isAdmin() && ! empty($args['companies_id']) ? $args['companies_id'] : auth()->user()->currentCompanyId(); + $app = app(Apps::class); /** * @var Builder */ - return Users::select('users.*') - ->join( - 'users_associated_company', - 'users_associated_company.users_id', - 'users.id' - ) - ->where( - 'users_associated_company.companies_id', - $companiesId - ) - ->where( - 'users_associated_company.is_deleted', - StateEnums::NO->getValue() - ) - ->groupBy('users.id'); + return Users::select('users.id', 'users.dob', 'users.sex','users_associated_apps.*') + ->join( + 'users_associated_company', + 'users_associated_company.users_id', + 'users.id' + ) + ->join( + 'users_associated_apps', + 'users_associated_apps.users_id', + 'users.id' + ) + ->where('users_associated_company.companies_id', $companiesId) + ->where('users_associated_apps.apps_id', $app->getId()) + ->where('users_associated_company.is_deleted', StateEnums::NO->getValue()) + ->where('users_associated_apps.is_deleted', StateEnums::NO->getValue()) + ->groupBy('users.id'); } /** @@ -45,23 +47,40 @@ public function getAllCompanyUsers(mixed $root, array $args, GraphQLContext $con */ public function getAllCompanyBranchUsers(mixed $root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): Builder { - $companiesId = auth()->user()->isAdmin() && ! empty($args['companies_id']) ? $args['companies_id'] : auth()->user()->currentCompanyId(); + $branchId = auth()->user()->isAdmin() && ! empty($args['getCurrentBranch']) ? $args['getCurrentBranch'] : auth()->user()->currentBranchId(); + $app = app(Apps::class); /** * @var Builder */ - return Users::join( + return Users::select('users.id', 'users.dob', 'users.sex','users_associated_apps.*') + ->join( 'users_associated_company', 'users_associated_company.users_id', 'users.id' ) + ->join( + 'users_associated_apps', + 'users_associated_apps.users_id', + 'users.id' + ) ->where( 'users_associated_company.is_deleted', StateEnums::NO->getValue() ) ->where( 'users_associated_company.companies_branches_id', - $companiesId - ); + $branchId + ) + ->where( + 'users_associated_apps.is_deleted', + StateEnums::NO->getValue() + ) + ->where( + 'users_associated_apps.apps_id', + $app->getId() + ) + ->groupBy('users.id') + ->select('users.*'); } } diff --git a/graphql/schemas/Ecosystem/company.graphql b/graphql/schemas/Ecosystem/company.graphql index 081d7a8c64..cc70934f40 100644 --- a/graphql/schemas/Ecosystem/company.graphql +++ b/graphql/schemas/Ecosystem/company.graphql @@ -130,6 +130,20 @@ type CompanySettings { settings: Mixed } +enum CompanyUserEnumColumn { + ID @enum(value: "users.id") + UUID @enum(value: "users.uuid") + COMPANIES_ID @enum(value: "users_associated_company.companies_id") + COMPANIES_BRANCHES_ID @enum(value: "users_associated_company.companies_branches_id") + DISPLAYNAME @enum(value: "users_associated_apps.displayname") + FIRSTNAME @enum(value: "users_associated_apps.firstname") + LASTNAME @enum(value: "users_associated_apps.lastname") + EMAIL @enum(value: "users_associated_apps.email") + USER_ACTIVE @enum(value: "users_associated_company.user_active") + CREATED_AT @enum(value: "users_associated_apps.created_at") + UPDATE_AT @enum(value: "users_associated_apps.updated_at") +} + extend type Query @guard { companies( search: String @search @@ -193,22 +207,7 @@ extend type Query @guard { ) companyUsers( - where: _ - @whereConditions( - columns: [ - "id" - "companies_id" - "uuid" - "firstname" - "lastname" - "displayname" - "email" - "phone" - "user_active" - "created_at" - "updated_at" - ] - ) + where: _ @whereConditions(columnsEnum: CompanyUserEnumColumn) orderBy: _ @orderBy(columns: ["created_at", "updated_at", "id", "name"]) ): [User!]! @paginate( @@ -217,22 +216,8 @@ extend type Query @guard { ) companyBranchUsers( - where: _ - @whereConditions( - columns: [ - "id" - "uuid" - "companies_id" - "firstname" - "lastname" - "displayname" - "email" - "phone" - "user_active" - "created_at" - "updated_at" - ] - ) + where: _ @whereConditions(columnsEnum: CompanyUserEnumColumn) + orderBy: _ @orderBy(columns: ["created_at", "updated_at", "id", "name"]) ): [User!]! @paginate( builder: "App\\GraphQL\\Ecosystem\\Queries\\Companies\\UserManagementQuery@getAllCompanyBranchUsers" From a41296616a934dc4ee7724bd398404eee7ac9a3e Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 21:47:02 -0400 Subject: [PATCH 53/58] refact: fix company users and branch --- .../Ecosystem/Queries/Companies/UserManagementQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php index 20c307723c..2432d9e1bb 100644 --- a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php +++ b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php @@ -24,7 +24,7 @@ public function getAllCompanyUsers(mixed $root, array $args, GraphQLContext $con /** * @var Builder */ - return Users::select('users.id', 'users.dob', 'users.sex','users_associated_apps.*') + return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', 'users_associated_company.users_id', @@ -53,7 +53,7 @@ public function getAllCompanyBranchUsers(mixed $root, array $args, GraphQLContex /** * @var Builder */ - return Users::select('users.id', 'users.dob', 'users.sex','users_associated_apps.*') + return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', 'users_associated_company.users_id', From 200814827359d6a41f17e85e9c712518c367c68b Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 21:47:23 -0400 Subject: [PATCH 54/58] refact: fix company users and branch --- .../Ecosystem/Queries/Companies/UserManagementQuery.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php index 2432d9e1bb..191e92b74b 100644 --- a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php +++ b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php @@ -21,9 +21,6 @@ public function getAllCompanyUsers(mixed $root, array $args, GraphQLContext $con $companiesId = auth()->user()->isAdmin() && ! empty($args['companies_id']) ? $args['companies_id'] : auth()->user()->currentCompanyId(); $app = app(Apps::class); - /** - * @var Builder - */ return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', @@ -50,9 +47,6 @@ public function getAllCompanyBranchUsers(mixed $root, array $args, GraphQLContex $branchId = auth()->user()->isAdmin() && ! empty($args['getCurrentBranch']) ? $args['getCurrentBranch'] : auth()->user()->currentBranchId(); $app = app(Apps::class); - /** - * @var Builder - */ return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', From b44b36f6dd186a14e38052ceae8295932fc9a2bf Mon Sep 17 00:00:00 2001 From: kaioken Date: Sun, 23 Jun 2024 22:07:25 -0400 Subject: [PATCH 55/58] fix: missing fields --- .../Ecosystem/Queries/Companies/UserManagementQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php index 191e92b74b..4d5812332d 100644 --- a/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php +++ b/app/GraphQL/Ecosystem/Queries/Companies/UserManagementQuery.php @@ -21,7 +21,7 @@ public function getAllCompanyUsers(mixed $root, array $args, GraphQLContext $con $companiesId = auth()->user()->isAdmin() && ! empty($args['companies_id']) ? $args['companies_id'] : auth()->user()->currentCompanyId(); $app = app(Apps::class); - return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') + return Users::select('users.id', 'users.uuid', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', 'users_associated_company.users_id', @@ -47,7 +47,7 @@ public function getAllCompanyBranchUsers(mixed $root, array $args, GraphQLContex $branchId = auth()->user()->isAdmin() && ! empty($args['getCurrentBranch']) ? $args['getCurrentBranch'] : auth()->user()->currentBranchId(); $app = app(Apps::class); - return Users::select('users.id', 'users.dob', 'users.sex', 'users_associated_apps.*') + return Users::select('users.id', 'users.uuid', 'users.dob', 'users.sex', 'users_associated_apps.*') ->join( 'users_associated_company', 'users_associated_company.users_id', From b8bfbd89ef569f861d38dd97ce2e6631e25ca30b Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 24 Jun 2024 00:40:28 -0400 Subject: [PATCH 56/58] refact: zoho lead --- .../Guild/Builders/Leads/DashboardBuilder.php | 4 +- app/Http/Controllers/ReceiverController.php | 9 +++ .../Zoho/Actions/SyncZohoLeadAction.php | 58 +++++++++++++++++++ src/Domains/Connectors/Zoho/ZohoService.php | 6 ++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php diff --git a/app/GraphQL/Guild/Builders/Leads/DashboardBuilder.php b/app/GraphQL/Guild/Builders/Leads/DashboardBuilder.php index 98c084fa32..3ab91b2a7b 100644 --- a/app/GraphQL/Guild/Builders/Leads/DashboardBuilder.php +++ b/app/GraphQL/Guild/Builders/Leads/DashboardBuilder.php @@ -35,7 +35,7 @@ public function getCompanyInfo( COUNT(CASE WHEN leads_status.name = ? THEN 1 END) + COUNT(CASE WHEN leads_status.name = ? THEN 1 END) as total_active_leads, COUNT(CASE WHEN leads_status.name = ? THEN 1 END) as total_closed_leads, (SELECT count(*) FROM agents where owner_linked_source_id = ? AND companies_id = ? and status_id = 1) as total_agents - ', ['active', 'created', 'closed', $agentInfo->users_linked_source_id, $company->getId()]) + ', ['active', 'created', 'complete', $agentInfo->users_linked_source_id, $company->getId()]) ->join('leads_status', 'leads.leads_status_id', '=', 'leads_status.id') ->fromCompany($company); } @@ -47,7 +47,7 @@ public function getCompanyInfo( COUNT(CASE WHEN leads_status.name = ? THEN 1 END) + COUNT(CASE WHEN leads_status.name = ? THEN 1 END) as total_active_leads, COUNT(CASE WHEN leads_status.name = ? THEN 1 END) as total_closed_leads, (SELECT count(*) FROM agents where owner_id = ? AND companies_id = ? and status_id = 1) as total_agents - ', ['active', 'created', 'closed', $memberId, $company->getId()]) + ', ['active', 'created', 'complete', $memberId, $company->getId()]) ->join('leads_status', 'leads.leads_status_id', '=', 'leads_status.id') ->fromCompany($company); } diff --git a/app/Http/Controllers/ReceiverController.php b/app/Http/Controllers/ReceiverController.php index 0b88045284..58d60e4b4d 100644 --- a/app/Http/Controllers/ReceiverController.php +++ b/app/Http/Controllers/ReceiverController.php @@ -9,8 +9,10 @@ use Illuminate\Http\Request; use Illuminate\Routing\Controller as BaseController; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; use Kanvas\Apps\Models\Apps; use Kanvas\Connectors\Zoho\Actions\SyncZohoAgentAction; +use Kanvas\Connectors\Zoho\Actions\SyncZohoLeadAction; use Kanvas\Connectors\Zoho\Workflows\ZohoLeadOwnerWorkflow; use Kanvas\Guild\Leads\Models\LeadReceiver; use Workflow\WorkflowStub; @@ -32,6 +34,7 @@ public function store(string $uuid, Request $request): JsonResponse } $tempSubSystem = $uuid == $app->get('subsystem-temp-uuid'); + $zohoLeadTempSubSystem = $uuid == $app->get('zoho-lead-temp-uuid'); Auth::loginUsingId($receiver->users_id); @@ -61,6 +64,12 @@ public function store(string $uuid, Request $request): JsonResponse return response()->json(['message' => 'Receiver processed']); } + if($zohoLeadTempSubSystem) { + $syncLead = new SyncZohoLeadAction($app, $receiver->company, $leadExternalId); + $syncLead->execute(); + return response()->json(['message' => 'Receiver processed']); + } + $workflow = WorkflowStub::make(ZohoLeadOwnerWorkflow::class); $workflow->start($leadExternalId, $receiver, app(Apps::class), []); diff --git a/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php b/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php new file mode 100644 index 0000000000..26b7109f55 --- /dev/null +++ b/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php @@ -0,0 +1,58 @@ +app, $this->company); + + try { + $zohoLead = $zohoService->getLeadById($this->zohoLeadId); + } catch (\Exception $e) { + Log::error('Error getting Zoho Lead', ['error' => $e->getMessage()]); + + return; + } + + $localLead = Lead::getByCustomField( + CustomFieldEnum::ZOHO_LEAD_ID->value, + $this->zohoLeadId, + $this->company + ); + + if (! $localLead) { + return ; + } + + $status = $zohoLead->Lead_Status; + + $leadStatus = match (true) { + Str::contains($status, 'close') => LeadStatus::getByName('bad'), + Str::contains($status, 'won') => LeadStatus::getByName('complete'), + default => LeadStatus::getByName('active'), + }; + + $localLead->leads_status_id = $leadStatus->getId(); + $localLead->saveOrFail(); + } +} diff --git a/src/Domains/Connectors/Zoho/ZohoService.php b/src/Domains/Connectors/Zoho/ZohoService.php index 36c771cd5b..55787e9828 100644 --- a/src/Domains/Connectors/Zoho/ZohoService.php +++ b/src/Domains/Connectors/Zoho/ZohoService.php @@ -11,6 +11,7 @@ use Kanvas\Connectors\Zoho\Enums\CustomFieldEnum; use Kanvas\Guild\Agents\Models\Agent; use Kanvas\Guild\Leads\Models\Lead; +use Webleit\ZohoCrmApi\Models\Record; use Webleit\ZohoCrmApi\ZohoCrm; class ZohoService @@ -80,6 +81,11 @@ public function createAgent(UserInterface $user, Agent $agentInfo, ?object $zoho return $zohoAgent; } + public function getLeadById(string $leadId): Record + { + return $this->zohoCrm->leads->get($leadId); + } + public function deleteLead(Lead $lead): void { $zohoLeadId = $lead->get(CustomFieldEnum::ZOHO_LEAD_ID->value); From 76aa556d952427acea3d57bec6e5ef7428fc5d49 Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 24 Jun 2024 00:45:53 -0400 Subject: [PATCH 57/58] fix: type --- app/Http/Controllers/ReceiverController.php | 4 ++-- src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ReceiverController.php b/app/Http/Controllers/ReceiverController.php index 58d60e4b4d..e36ea7d6e8 100644 --- a/app/Http/Controllers/ReceiverController.php +++ b/app/Http/Controllers/ReceiverController.php @@ -9,7 +9,6 @@ use Illuminate\Http\Request; use Illuminate\Routing\Controller as BaseController; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Log; use Kanvas\Apps\Models\Apps; use Kanvas\Connectors\Zoho\Actions\SyncZohoAgentAction; use Kanvas\Connectors\Zoho\Actions\SyncZohoLeadAction; @@ -64,9 +63,10 @@ public function store(string $uuid, Request $request): JsonResponse return response()->json(['message' => 'Receiver processed']); } - if($zohoLeadTempSubSystem) { + if ($zohoLeadTempSubSystem) { $syncLead = new SyncZohoLeadAction($app, $receiver->company, $leadExternalId); $syncLead->execute(); + return response()->json(['message' => 'Receiver processed']); } diff --git a/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php b/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php index 26b7109f55..427cffeb0d 100644 --- a/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php +++ b/src/Domains/Connectors/Zoho/Actions/SyncZohoLeadAction.php @@ -39,7 +39,7 @@ public function execute(): void $this->zohoLeadId, $this->company ); - + if (! $localLead) { return ; } From 9854326d524cb1e6e3e9a0bdba715f1697a3e0ce Mon Sep 17 00:00:00 2001 From: kaioken Date: Mon, 24 Jun 2024 09:48:02 -0400 Subject: [PATCH 58/58] composer update --- composer.lock | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index e790390846..3999b6a8ef 100644 --- a/composer.lock +++ b/composer.lock @@ -1141,16 +1141,16 @@ }, { "name": "aws/aws-crt-php", - "version": "v1.2.5", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/awslabs/aws-crt-php.git", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b" + "reference": "a63485b65b6b3367039306496d49737cf1995408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", - "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/a63485b65b6b3367039306496d49737cf1995408", + "reference": "a63485b65b6b3367039306496d49737cf1995408", "shasum": "" }, "require": { @@ -1189,22 +1189,22 @@ ], "support": { "issues": "https://github.com/awslabs/aws-crt-php/issues", - "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.5" + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.6" }, - "time": "2024-04-19T21:30:56+00:00" + "time": "2024-06-13T17:21:28+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.314.2", + "version": "3.314.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef" + "reference": "d04da330b0201edab71edd33a03b8d5ad6e4a313" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef", - "reference": "1f5ccf9c73a66fb85c7c5de8f11ed69e44c636ef", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d04da330b0201edab71edd33a03b8d5ad6e4a313", + "reference": "d04da330b0201edab71edd33a03b8d5ad6e4a313", "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.314.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.314.6" }, - "time": "2024-06-14T18:11:34+00:00" + "time": "2024-06-20T18:09:51+00:00" }, { "name": "berkayk/onesignal-laravel", @@ -2503,16 +2503,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.359.0", + "version": "v0.361.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338" + "reference": "f90e9a059ce5a6076b4fc8571a4fac6564012782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338", - "reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/f90e9a059ce5a6076b4fc8571a4fac6564012782", + "reference": "f90e9a059ce5a6076b4fc8571a4fac6564012782", "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.359.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.361.0" }, - "time": "2024-06-10T01:02:17+00:00" + "time": "2024-06-23T01:02:19+00:00" }, { "name": "google/auth", @@ -7354,16 +7354,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.38", + "version": "3.0.39", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "b18b8788e51156c4dd97b7f220a31149a0052067" + "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b18b8788e51156c4dd97b7f220a31149a0052067", - "reference": "b18b8788e51156c4dd97b7f220a31149a0052067", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/211ebc399c6e73c225a018435fe5ae209d1d1485", + "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485", "shasum": "" }, "require": { @@ -7444,7 +7444,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.38" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.39" }, "funding": [ { @@ -7460,7 +7460,7 @@ "type": "tidelift" } ], - "time": "2024-06-17T10:11:32+00:00" + "time": "2024-06-24T06:27:33+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -13445,16 +13445,16 @@ }, { "name": "webonyx/graphql-php", - "version": "v15.12.4", + "version": "v15.12.5", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "4ddba1634c4c2d09c39623d6c13fa550588ed8b1" + "reference": "7bcd31d1dcf67781ed5cb493b22c519c539c05e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/4ddba1634c4c2d09c39623d6c13fa550588ed8b1", - "reference": "4ddba1634c4c2d09c39623d6c13fa550588ed8b1", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/7bcd31d1dcf67781ed5cb493b22c519c539c05e6", + "reference": "7bcd31d1dcf67781ed5cb493b22c519c539c05e6", "shasum": "" }, "require": { @@ -13507,7 +13507,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.12.4" + "source": "https://github.com/webonyx/graphql-php/tree/v15.12.5" }, "funding": [ { @@ -13515,7 +13515,7 @@ "type": "open_collective" } ], - "time": "2024-06-19T13:54:11+00:00" + "time": "2024-06-23T11:30:58+00:00" } ], "packages-dev": [