Skip to content

Commit

Permalink
Revert "refactor: delete in job"
Browse files Browse the repository at this point in the history
This reverts commit 65bbf21.
  • Loading branch information
FredPeal committed Feb 8, 2024
1 parent 65bbf21 commit 37b4859
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use Illuminate\Support\Facades\Auth;
use Kanvas\Apps\Models\Apps;
use Kanvas\Companies\Actions\CreateCompaniesAction;
use Kanvas\Companies\Actions\DeleteCompaniesAction;
use Kanvas\Companies\Actions\UpdateCompaniesAction;
use Kanvas\Companies\DataTransferObject\CompaniesPostData;
use Kanvas\Companies\DataTransferObject\CompaniesPutData;
use Kanvas\Companies\Jobs\DeleteCompanyJob;
use Kanvas\Companies\Models\Companies;
use Kanvas\Companies\Models\CompaniesBranches;
use Kanvas\Companies\Repositories\CompaniesRepository;
Expand Down Expand Up @@ -65,7 +65,8 @@ public function deleteCompany(mixed $root, array $request): bool
/**
* @todo only super admin can do this
*/
DeleteCompanyJob::dispatch((int) $request['id'], Auth::user());
$companyDelete = new DeleteCompaniesAction(Auth::user());
$companyDelete->execute((int) $request['id']);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Kanvas/Companies/Actions/DeleteCompaniesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function execute(int $id): bool
{
$companies = Companies::getById($id);

if (! $companies->isOwner($this->user) && ! $this->user->isAdmin()) {
if (! $companies->isOwner($this->user)) {
throw new AuthorizationException('User cant delete this company');
}

Expand Down
33 changes: 0 additions & 33 deletions src/Kanvas/Companies/Jobs/DeleteCompanyJob.php

This file was deleted.

0 comments on commit 37b4859

Please sign in to comment.