-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1668 from bakaphp/development
Release RC4
- Loading branch information
Showing
60 changed files
with
1,306 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/Console/Commands/Workflows/KanvasCreateReceiverCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Console\Commands\Workflows; | ||
|
||
use Illuminate\Console\Command; | ||
use Kanvas\Apps\Models\Apps; | ||
use Kanvas\Companies\Models\Companies; | ||
use Kanvas\Users\Repositories\UsersRepository; | ||
use Kanvas\Workflow\Models\ReceiverWebhook; | ||
use Kanvas\Workflow\Models\WorkflowAction; | ||
|
||
use function Laravel\Prompts\select; | ||
|
||
class KanvasCreateReceiverCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'kanvas:create-receiver-workflow'; | ||
|
||
public function handle(): void | ||
{ | ||
$this->info('Creating Receiver...'); | ||
$app = select( | ||
label: 'Select the app for the receiver: ', | ||
options: Apps::pluck('name', 'id'), | ||
); | ||
|
||
$action = select( | ||
label: 'Select the action for the receiver: ', | ||
options: WorkflowAction::pluck('name', 'id'), | ||
); | ||
|
||
$userId = $this->ask('Enter the user ID for the receiver: '); | ||
$companyId = $this->ask('Enter the company ID for the receiver: '); | ||
$name = $this->ask('Enter the name for the receiver: '); | ||
$description = $this->ask('Enter the description for the receiver: '); | ||
|
||
$company = Companies::getById($companyId); | ||
|
||
$user = UsersRepository::getUserOfCompanyById($company, (int)$userId); | ||
|
||
$receiver = ReceiverWebhook::create([ | ||
'apps_id' => $app, | ||
'action_id' => $action, | ||
'companies_id' => $company->getId(), | ||
'users_id' => $user->getId(), | ||
'name' => $name, | ||
'description' => $description, | ||
'is_active' => true, | ||
'is_deleted' => false, | ||
]); | ||
|
||
$this->info('Receiver created successfully!'); | ||
$url = config('app.url') . '/receiver/' . $receiver->uuid; | ||
$this->info('Webhook URL: ' . $url); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\GraphQL\Guild\Queries; | ||
|
||
use Baka\Traits\KanvasScopesTrait; | ||
use Kanvas\Enums\StateEnums; | ||
use Kanvas\Guild\Customers\Models\People; | ||
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext; | ||
|
||
class PeopleManagementQueries | ||
{ | ||
use KanvasScopesTrait; | ||
protected string $table = 'peoples'; | ||
|
||
public function countByTag(mixed $root, array $request, GraphQLContext $context): int | ||
{ | ||
$builder = People::whereHas('tags', function ($query) use ($request) { | ||
$query->where('tags.name', $request['tag']); | ||
}); | ||
|
||
$builder->where('is_deleted', StateEnums::NO->getValue()); | ||
$builder = $this->scopeFromCompany($builder); | ||
$builder = $this->scopeFromApp($builder); | ||
|
||
return $builder->count(); | ||
} | ||
|
||
public function getBySubscriptionType(mixed $root, array $request, GraphQLContext $context): int | ||
{ | ||
$builder = People::whereHas('subscriptions', function ($query) use ($request) { | ||
$query->where('peoples_subscriptions.subscription_type', $request['type']); | ||
}); | ||
|
||
$builder->where('is_deleted', StateEnums::NO->getValue()); | ||
$builder = $this->scopeFromCompany($builder); | ||
$builder = $this->scopeFromApp($builder); | ||
|
||
return $builder->count(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/GraphQL/Social/Builders/Interactions/EntityInteractionsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\GraphQL\Social\Builders\Interactions; | ||
|
||
use Baka\Enums\StateEnums; | ||
use GraphQL\Type\Definition\ResolveInfo; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Kanvas\Social\Interactions\Models\EntityInteractions; | ||
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext; | ||
|
||
class EntityInteractionsBuilder | ||
{ | ||
public function getAll( | ||
mixed $root, | ||
array $args, | ||
GraphQLContext $context, | ||
ResolveInfo $resolveInfo | ||
): Builder { | ||
return EntityInteractions::where('entity_id', '=', $root->uuid) | ||
->where('entity_namespace', '=', $root::class) | ||
->where('is_deleted', '=', StateEnums::NO->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.