Receber documentos privados e locais de disponibilidade nas candidaturas
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\PeopleProcess;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Services\CandidateAccess;
|
||||
use App\Services\CandidateDocuments;
|
||||
use App\Services\CandidateProfiles;
|
||||
use App\Services\CandidateSubmissions;
|
||||
use App\Services\CandidateTriage;
|
||||
@@ -200,7 +201,43 @@ class CandidatePortalController extends Controller
|
||||
abort_unless($row !== null, 404);
|
||||
app(CandidateProfiles::class)->event($account, 'submission.consulted', ['submission_id' => $row->id]);
|
||||
|
||||
return $this->page($request, 'candidate/receipt', ['companyId' => $company, 'decision' => app(CandidateTriage::class)->publicDecision($company, $submission), 'receipt' => ['reference' => $row->reference, 'received_at' => $row->created_at, 'snapshot' => json_decode($row->snapshot, true, 32, JSON_THROW_ON_ERROR)]]);
|
||||
return $this->page($request, 'candidate/receipt', ['companyId' => $company, 'decision' => app(CandidateTriage::class)->publicDecision($company, $submission), 'receipt' => ['id' => $row->id, 'reference' => $row->reference, 'received_at' => $row->created_at, 'snapshot' => json_decode($row->snapshot, true, 32, JSON_THROW_ON_ERROR)]]);
|
||||
}
|
||||
|
||||
public function candidateDocument(Request $request, int $company, int $submission, string $document): Response
|
||||
{
|
||||
$account = $this->account($request, $company);
|
||||
abort_unless($account !== null, 401);
|
||||
$row = DB::table('candidate_submissions')->where('tenant_id', $company)->where('candidate_account_id', $account->id)->where('id', $submission)->first();
|
||||
abort_unless($row !== null, 404);
|
||||
$file = $this->submissionDocument($company, $row->people_process_id, $submission, $document);
|
||||
app(CandidateProfiles::class)->event($account, 'submission.document_downloaded', ['submission_id' => $submission, 'document_key' => $document]);
|
||||
|
||||
return app(CandidateDocuments::class)->download((array) $file);
|
||||
}
|
||||
|
||||
public function staffDocument(Request $request, int $process, int $submission, string $document): Response
|
||||
{
|
||||
return DB::transaction(function () use ($request, $process, $submission, $document) {
|
||||
$actor = $this->staff($request);
|
||||
app(ConflictGuard::class)->lockCompany($actor);
|
||||
$actor = app(CurrentActor::class)->lock($actor);
|
||||
$record = PeopleProcess::query()->where('tenant_id', $actor->tenant_id)->where('id', $process)->firstOrFail();
|
||||
abort_unless(app(CandidateTriage::class)->canRead($actor, $record), 403);
|
||||
$file = $this->submissionDocument($actor->tenant_id, $process, $submission, $document);
|
||||
app(RequisitionWorkflow::class)->audit($actor, 'candidate_submission.document_downloaded', null, null, ['process_id' => $process, 'submission_id' => $submission, 'document_key' => $document]);
|
||||
|
||||
return app(CandidateDocuments::class)->download((array) $file);
|
||||
});
|
||||
}
|
||||
|
||||
private function submissionDocument(int $company, int $process, int $submission, string $key): \stdClass
|
||||
{
|
||||
abort_unless(Schema::hasTable('candidate_submission_documents'), 404);
|
||||
$row = DB::table('candidate_submission_documents')->where('tenant_id', $company)->where('people_process_id', $process)->where('candidate_submission_id', $submission)->where('document_key', $key)->first();
|
||||
abort_unless($row !== null, 404);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function inbox(Request $request, int $process, CandidateSubmissions $submissions): Response
|
||||
|
||||
Reference in New Issue
Block a user