-
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 #1472 from bakaphp/development
v1.0-BETA36
- Loading branch information
Showing
107 changed files
with
2,512 additions
and
193 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ on: | |
push: | ||
branches: | ||
- '1.x' | ||
- 'development' | ||
|
||
workflow_dispatch: | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: Deploy to EC2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'development' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
|
@@ -20,4 +24,25 @@ jobs: | |
username: ${{ secrets.AWS_EC2_USERNAME }} | ||
key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} | ||
source: . | ||
target: ${{secrets.AWS_EC2_TARGET_DIR}} | ||
target: ${{secrets.AWS_EC2_TARGET_DIR}} | ||
docker-command: | ||
name: Docker commands | ||
runs-on: ubuntu-latest | ||
needs: deploy-to-ec2 | ||
environment: ${{ github.ref_name }} | ||
steps: | ||
- name: executing remote ssh commands using password | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.AWS_EC2_HOST }} | ||
username: ${{ secrets.AWS_EC2_USERNAME }} | ||
key: ${{ secrets.AWS_EC2_PRIVATE_SSH_KEY }} | ||
script: | | ||
cd ${{secrets.AWS_EC2_TARGET_DIR}} | ||
docker compose -f docker-compose.dev.yml up -d | ||
docker exec -i phpkanvas-ecosystem php artisan lighthouse:cache | ||
docker exec -i phpkanvas-ecosystem php artisan config:cache | ||
docker restart queue | ||
docker restart queue-notifications | ||
docker restart queue-social | ||
docker restart laravel-scheduler |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Kanvas\Apps\Repositories\AppsRepository; | ||
use Kanvas\Users\Models\RequestDeletedAccount; | ||
use Illuminate\Support\Facades\DB; | ||
use Kanvas\Apps\Models\Apps; | ||
|
||
class DeleteUsersRequestedCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'kanvas:user:delete {apps_id?}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string|null | ||
*/ | ||
protected $description = 'Delete a user'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$appsId = $this->argument('apps_id'); | ||
if ($appsId) { | ||
$app = Apps::findFirstOrFail($appsId); | ||
$this->info('Deleting user from app: ' . $app->name); | ||
} | ||
$days = $appsId ? $app->get('days_to_delete') : 30; | ||
$users = RequestDeletedAccount::when($appsId, function ($query) use ($appsId) { | ||
return $query->where('apps_id', $appsId); | ||
})->where(DB::raw('DATEDIFF(request_date, CURDATE())'), '>', $days) | ||
->where('is_deleted', 0) | ||
->get(); | ||
foreach ($users as $user) { | ||
echo 'Deleting user: ' . $user->email . PHP_EOL; | ||
$user->associateUsers()->deActive(); | ||
} | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
app/GraphQL/ActionEngine/Builders/Engagements/TaskEngagementBuilder.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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\GraphQL\ActionEngine\Builders\Engagements; | ||
|
||
use GraphQL\Type\Definition\ResolveInfo; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Kanvas\ActionEngine\Tasks\Models\TaskListItem; | ||
use Kanvas\Apps\Models\Apps; | ||
use Kanvas\Guild\Leads\Models\Lead; | ||
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext; | ||
|
||
class TaskEngagementBuilder | ||
{ | ||
public function getLeadTaskItems( | ||
mixed $root, | ||
array $args, | ||
GraphQLContext $context, | ||
ResolveInfo $resolveInfo | ||
): Builder { | ||
$company = auth()->user()->getCurrentCompany(); | ||
$user = auth()->user(); | ||
$app = app(Apps::class); | ||
|
||
$lead = Lead::getByIdFromCompanyApp($args['lead_id'], $company, $app); | ||
$leadId = $lead->getId(); | ||
|
||
return TaskListItem::leftJoin('company_task_engagement_items', function ($join) use ($lead) { | ||
$join->on('company_task_list_items.id', '=', 'company_task_engagement_items.task_list_item_id') | ||
->where('company_task_engagement_items.lead_id', '=', $lead->getId()); | ||
}) | ||
->select( | ||
'company_task_list_items.*', | ||
'company_task_engagement_items.lead_id', | ||
'company_task_engagement_items.status', | ||
'company_task_engagement_items.engagement_start_id', | ||
'company_task_engagement_items.engagement_end_id', | ||
'company_task_engagement_items.created_at', | ||
'company_task_engagement_items.updated_at' | ||
); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/GraphQL/ActionEngine/Mutations/Engagements/TaskEngagementMutation.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,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\GraphQL\ActionEngine\Mutations\Engagements; | ||
|
||
use Kanvas\ActionEngine\Tasks\Models\TaskEngagementItem; | ||
use Kanvas\ActionEngine\Tasks\Models\TaskListItem; | ||
use Kanvas\Apps\Models\Apps; | ||
use Kanvas\Exceptions\ValidationException; | ||
use Kanvas\Guild\Leads\Models\Lead; | ||
|
||
class TaskEngagementMutation | ||
{ | ||
public function changeEngagementTaskItemStatus(mixed $rootValue, array $request): bool | ||
{ | ||
$id = (int) $request['id']; | ||
$user = auth()->user(); | ||
$company = $user->getCurrentCompany(); | ||
$app = app(Apps::class); | ||
$status = $request['status']; | ||
$lead = Lead::getByIdFromCompanyApp($request['lead_id'], $company, $app); | ||
|
||
$taskListItem = TaskListItem::getById($id); | ||
|
||
if ($taskListItem->companyAction->companies_id != $company->getId()) { | ||
throw new ValidationException('You are not allowed to change the status of this task , company mismatch'); | ||
} | ||
|
||
if ($taskListItem->companyAction->apps_id != $app->getId()) { | ||
throw new ValidationException('You are not allowed to change the status of this task , app mismatch'); | ||
} | ||
|
||
$taskEngagementItem = TaskEngagementItem::fromCompany($company) | ||
->fromApp($app) | ||
->where('task_list_item_id', $taskListItem->getId()) | ||
->where('lead_id', $lead->getId()) | ||
->first(); | ||
|
||
if (! $taskEngagementItem) { | ||
$taskEngagementItem = new TaskEngagementItem(); | ||
$taskEngagementItem->task_list_item_id = $taskListItem->getId(); | ||
$taskEngagementItem->lead_id = $lead->getId(); | ||
$taskEngagementItem->companies_id = $company->getId(); | ||
$taskEngagementItem->apps_id = $app->getId(); | ||
$taskEngagementItem->users_id = $user->getId(); | ||
} | ||
|
||
$taskEngagementItem->status = $status; | ||
|
||
return $taskEngagementItem->saveOrFail(); | ||
} | ||
} |
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.