forked from Silvanite/novatoolpermissions
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Silvanite#38 from SGS-Optimisation/feature/job-search
Feature/job search
- Loading branch information
Showing
26 changed files
with
781 additions
and
239 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Events\Jobs; | ||
|
||
use App\Models\Job; | ||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class NewJobSearched | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* @var Job | ||
*/ | ||
public $mysgs_job; | ||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Job $mysgs_job) | ||
{ | ||
$this->mysgs_job = $mysgs_job; | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return \Illuminate\Broadcasting\Channel|array | ||
*/ | ||
public function broadcastOn() | ||
{ | ||
return new PrivateChannel('channel-name'); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Services\Job\JobApiHandler; | ||
use App\Services\Rule\RuleFilter; | ||
use Illuminate\Http\Request; | ||
use Laravel\Jetstream\Jetstream; | ||
|
||
class HomeController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @param Request $request | ||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Inertia\Response | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
return Jetstream::inertia()->render($request, 'Dashboard', [ | ||
'team' => $request->user()->currentTeam, | ||
]); | ||
} | ||
} |
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,75 @@ | ||
<?php | ||
|
||
namespace App\Listeners\Jobs; | ||
|
||
use App\Events\Jobs\NewJobSearched; | ||
use App\Models\Job; | ||
use App\Services\MySgs\DataLoader; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldBeUnique; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Foundation\Bus\Dispatchable; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class LoadMySgsData implements ShouldQueue, ShouldBeUnique | ||
{ | ||
|
||
use InteractsWithQueue, Queueable; | ||
|
||
/** | ||
* @var Job | ||
*/ | ||
public $mysgs_job; | ||
|
||
/** | ||
* Create the event listener. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Handle the event. | ||
* | ||
* @param NewJobSearched $event | ||
* @return void | ||
*/ | ||
public function handle($event) | ||
{ | ||
$this->mysgs_job = $event->mysgs_job; | ||
|
||
logger('handling job '.$this->mysgs_job->job_number); | ||
|
||
DataLoader::handle($this->mysgs_job); | ||
} | ||
|
||
/** | ||
* The unique ID of the job. | ||
* | ||
* @return string | ||
*/ | ||
public function uniqueId() | ||
{ | ||
return $this->mysgs_job->id; | ||
} | ||
|
||
/** | ||
* @param $event | ||
* @param \Exception|null $exception | ||
*/ | ||
public function failed($event, $exception) | ||
{ | ||
\Log::error('loading mysgs data failed'); | ||
\Log::error($exception->getMessage()); | ||
\Log::error($exception->getTraceAsString()); | ||
$job_metadata = $event->mysgs_job->metadata; | ||
$job_metadata->error_mysgs = true; | ||
$event->mysgs_job->metadata = $job_metadata; | ||
|
||
$event->mysgs_job->save(); | ||
} | ||
} |
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
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.