Compare commits
4
Commits
bf84575d10
...
3b1ef2031c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b1ef2031c | ||
|
|
86b31f2840 | ||
|
|
f5f5649cfc | ||
|
|
c22846b2b1 |
@@ -16,6 +16,7 @@ use App\Services\CurrentActor;
|
||||
use App\Services\OrganizationConfiguration;
|
||||
use App\Services\RequisitionWorkflow;
|
||||
use App\Services\SubmissionForms;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -24,6 +25,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Inertia\Inertia;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class CandidatePortalController extends Controller
|
||||
{
|
||||
@@ -48,26 +50,36 @@ class CandidatePortalController extends Controller
|
||||
$portal = $profiles->portal($company);
|
||||
abort_unless($portal !== null, 404);
|
||||
$tenant = Tenant::query()->findOrFail($company);
|
||||
$filter = $request->validate(['opportunities_page' => 'sometimes|integer|min:1']);
|
||||
|
||||
return $this->page($request, 'candidate/entry', ['company' => ['id' => $company, 'name' => $tenant->name],
|
||||
'portal' => ['version' => $portal->version, 'registration_open' => (bool) $portal->registration_open, 'notice' => $portal->notice]]);
|
||||
'portal' => ['version' => $portal->version, 'registration_open' => (bool) $portal->registration_open, 'notice' => $portal->notice],
|
||||
'opportunities' => app(CandidateSubmissions::class)->publicOpportunities($company, (int) ($filter['opportunities_page'] ?? 1))]);
|
||||
}
|
||||
|
||||
public function register(Request $request, int $company, CandidateProfiles $profiles): Response
|
||||
{
|
||||
$selection = $request->validate(['opportunity_id' => 'nullable|integer|min:1|max:2147483647']);
|
||||
$account = $profiles->register($company, $request->all());
|
||||
Auth::guard('candidate')->login($account, false);
|
||||
$request->session()->put('candidate.session_version', $account->session_version);
|
||||
$request->session()->regenerate();
|
||||
Inertia::clearHistory();
|
||||
|
||||
return redirect('/candidaturas/'.$company.'/perfil');
|
||||
$selected = $this->rememberOpportunity($request, $account, isset($selection['opportunity_id']) ? (int) $selection['opportunity_id'] : null);
|
||||
$response = redirect('/candidaturas/'.$company.'/perfil');
|
||||
if (isset($selection['opportunity_id']) && $selected === null) {
|
||||
$response->with('candidate_access_status', 'opportunity_unavailable');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function login(Request $request, int $company, CandidateProfiles $profiles): Response
|
||||
{
|
||||
abort_unless($profiles->portal($company) !== null, 404);
|
||||
$data = $request->validate(['email' => 'required|string|max:254', 'password' => 'required|string|max:128']);
|
||||
$data = $request->validate(['email' => 'required|string|max:254', 'password' => 'required|string|max:128',
|
||||
'opportunity_id' => 'nullable|integer|min:1|max:2147483647']);
|
||||
$account = CandidateAccount::query()->where('tenant_id', $company)->where('email', mb_strtolower(trim($data['email'])))->first();
|
||||
$dummy = Hash::make('candidate-unavailable-account');
|
||||
$valid = Hash::check($data['password'], $account->password ?? $dummy);
|
||||
@@ -80,6 +92,14 @@ class CandidatePortalController extends Controller
|
||||
$request->session()->regenerate();
|
||||
Inertia::clearHistory();
|
||||
|
||||
$selected = $this->rememberOpportunity($request, $account, isset($data['opportunity_id']) ? (int) $data['opportunity_id'] : null);
|
||||
if ($selected !== null) {
|
||||
return redirect('/candidaturas/'.$company.'/oportunidades/'.$selected['id']);
|
||||
}
|
||||
if (isset($data['opportunity_id'])) {
|
||||
return redirect('/candidaturas/'.$company.'/perfil')->with('candidate_access_status', 'opportunity_unavailable');
|
||||
}
|
||||
|
||||
return redirect('/candidaturas/'.$company.'/perfil');
|
||||
}
|
||||
|
||||
@@ -90,14 +110,17 @@ class CandidatePortalController extends Controller
|
||||
return redirect('/candidaturas/'.$company);
|
||||
}
|
||||
$profiles->event($account, 'profile.consulted', []);
|
||||
$filter = $request->validate(['opportunities_page' => 'sometimes|integer|min:1|max:2147483647', 'submissions_page' => 'sometimes|integer|min:1|max:2147483647']);
|
||||
$opportunities = app(CandidateSubmissions::class)->publicOpportunities($company, (int) ($filter['opportunities_page'] ?? 1))->withPath('/candidaturas/'.$company.'/perfil')->appends(array_intersect_key($filter, ['submissions_page' => true]));
|
||||
$receipts = app(CandidateSubmissions::class)->receipts($account, (int) ($filter['submissions_page'] ?? 1))->appends(array_intersect_key($filter, ['opportunities_page' => true]));
|
||||
$selection = $request->session()->get('candidate.selected_opportunity');
|
||||
$scopedSelection = is_array($selection) && ($selection['company'] ?? null) === $company && ($selection['account'] ?? null) === $account->id && is_int($selection['id'] ?? null) && $selection['id'] > 0;
|
||||
$selected = $this->rememberOpportunity($request, $account, $scopedSelection ? (int) $selection['id'] : null);
|
||||
|
||||
return $this->page($request, 'candidate/profile', ['companyId' => $company, 'email' => $account->email, 'profile' => $profiles->profile($account),
|
||||
'emailVerified' => $account->email_verified_at !== null, 'accessStatus' => $request->session()->get('candidate_access_status'), 'emailDeliveryAvailable' => app(CandidateAccess::class)->deliveryAvailable(),
|
||||
'opportunities' => Schema::hasTable('candidate_opportunity_publications') ? DB::table('candidate_opportunity_publications as p')->join('people_processes as r', 'r.id', '=', 'p.people_process_id')
|
||||
->where('p.tenant_id', $company)->where('r.tenant_id', $company)->where('p.active', true)->where('r.status', 'open')->where('r.closes_on', '>=', today()->toDateString())
|
||||
->whereNotExists(fn ($q) => $q->selectRaw('1')->from('candidate_opportunity_publications as newer')->whereColumn('newer.people_process_id', 'p.people_process_id')->whereColumn('newer.version', '>', 'p.version'))
|
||||
->orderBy('r.closes_on')->limit(20)->get(['r.id', 'r.title', 'r.closes_on']) : [],
|
||||
'submissions' => Schema::hasTable('candidate_submissions') ? DB::table('candidate_submissions')->where('tenant_id', $company)->where('candidate_account_id', $account->id)->latest('id')->limit(20)->get(['id', 'reference', 'created_at']) : []]);
|
||||
'emailVerified' => $account->email_verified_at !== null, 'accessStatus' => $scopedSelection && $selected === null ? 'opportunity_unavailable' : $request->session()->get('candidate_access_status'), 'emailDeliveryAvailable' => app(CandidateAccess::class)->deliveryAvailable(),
|
||||
'opportunities' => $opportunities->items(), 'opportunityPagination' => ['prev' => $opportunities->previousPageUrl(), 'next' => $opportunities->nextPageUrl()], 'selectedOpportunity' => $selected,
|
||||
'submissions' => $receipts->items(), 'submissionPagination' => ['prev' => $receipts->previousPageUrl(), 'next' => $receipts->nextPageUrl(), 'total' => $receipts->total()]]);
|
||||
}
|
||||
|
||||
public function save(Request $request, int $company, CandidateProfiles $profiles): Response
|
||||
@@ -115,7 +138,7 @@ class CandidatePortalController extends Controller
|
||||
abort_unless($account !== null, 401);
|
||||
$profiles->event($account, 'account.logout', []);
|
||||
Auth::guard('candidate')->logout();
|
||||
$request->session()->forget('candidate.session_version');
|
||||
$request->session()->forget(['candidate.session_version', 'candidate.selected_opportunity']);
|
||||
$request->session()->regenerate();
|
||||
$request->session()->regenerateToken();
|
||||
Inertia::clearHistory();
|
||||
@@ -123,6 +146,23 @@ class CandidatePortalController extends Controller
|
||||
return redirect('/candidaturas/'.$company);
|
||||
}
|
||||
|
||||
/** @return array{id:int,title:string}|null */
|
||||
private function rememberOpportunity(Request $request, CandidateAccount $account, ?int $id): ?array
|
||||
{
|
||||
$request->session()->forget('candidate.selected_opportunity');
|
||||
if ($id === null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
$opportunity = app(CandidateSubmissions::class)->opportunity($account->tenant_id, $id);
|
||||
} catch (NotFoundHttpException|ModelNotFoundException) {
|
||||
return null;
|
||||
}
|
||||
$request->session()->put('candidate.selected_opportunity', ['company' => $account->tenant_id, 'account' => $account->id, 'id' => $id]);
|
||||
|
||||
return ['id' => $id, 'title' => $opportunity['title']];
|
||||
}
|
||||
|
||||
private function account(Request $request, int $company): ?CandidateAccount
|
||||
{
|
||||
$account = Auth::guard('candidate')->user();
|
||||
@@ -189,6 +229,10 @@ class CandidatePortalController extends Controller
|
||||
$account = $this->account($request, $company);
|
||||
abort_unless($account !== null, 401);
|
||||
$id = $submissions->submit($account, $process, $request->all());
|
||||
$selection = $request->session()->get('candidate.selected_opportunity');
|
||||
if (is_array($selection) && ($selection['company'] ?? null) === $company && ($selection['account'] ?? null) === $account->id && ($selection['id'] ?? null) === $process) {
|
||||
$request->session()->forget('candidate.selected_opportunity');
|
||||
}
|
||||
|
||||
return redirect('/candidaturas/'.$company.'/submissoes/'.$id);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Models\CandidateAccount;
|
||||
use App\Models\PeopleProcess;
|
||||
use App\Models\User;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -15,6 +16,37 @@ use stdClass;
|
||||
|
||||
class CandidateSubmissions
|
||||
{
|
||||
/** @return LengthAwarePaginator<int, stdClass> */
|
||||
public function receipts(CandidateAccount $account, int $page = 1): LengthAwarePaginator
|
||||
{
|
||||
$path = '/candidaturas/'.$account->tenant_id.'/perfil';
|
||||
if (! Schema::hasTable('candidate_submissions')) {
|
||||
return (new LengthAwarePaginator([], 0, 12, $page))->withPath($path)->setPageName('submissions_page');
|
||||
}
|
||||
|
||||
return DB::table('candidate_submissions')->where('tenant_id', $account->tenant_id)->where('candidate_account_id', $account->id)
|
||||
->orderByDesc('id')->paginate(12, ['id', 'reference', 'created_at', 'snapshot->opportunity->title as title'], 'submissions_page', $page)->withPath($path);
|
||||
}
|
||||
|
||||
/** Only explicitly published, current and open opportunities; no internal process fields.
|
||||
* @return LengthAwarePaginator<int, stdClass>
|
||||
*/
|
||||
public function publicOpportunities(int $company, int $page = 1): LengthAwarePaginator
|
||||
{
|
||||
$path = '/candidaturas/'.$company;
|
||||
if (! Schema::hasTable('candidate_opportunity_publications')) {
|
||||
return (new LengthAwarePaginator([], 0, 12, $page))->withPath($path)->setPageName('opportunities_page');
|
||||
}
|
||||
|
||||
return DB::table('candidate_opportunity_publications as p')->join('people_processes as r', 'r.id', '=', 'p.people_process_id')
|
||||
->where('p.tenant_id', $company)->where('r.tenant_id', $company)->where('p.active', true)
|
||||
->where('r.status', 'open')->where('r.closes_on', '>=', today()->toDateString())
|
||||
->whereNotExists(fn ($q) => $q->selectRaw('1')->from('candidate_opportunity_publications as newer')
|
||||
->whereColumn('newer.people_process_id', 'p.people_process_id')->whereColumn('newer.tenant_id', 'p.tenant_id')->whereColumn('newer.version', '>', 'p.version'))
|
||||
->orderBy('r.closes_on')->orderBy('r.id')
|
||||
->paginate(12, ['r.id', 'r.title', 'r.kind', 'r.closes_on', 'p.description'], 'opportunities_page', $page)->withPath($path);
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $input */
|
||||
public function publish(User $actor, int $processId, array $input): void
|
||||
{
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
# Desenvolvimento do SGC
|
||||
|
||||
## Histórico completo de comprovativos do candidato, 30 de Outubro de 2026
|
||||
|
||||
A área autenticada deixa de limitar a lista aos 20 comprovativos mais recentes. Tem paginação própria, contagem apenas da conta e empresa autenticadas e título extraído da oportunidade preservada na submissão, sem procurar o título actual do processo ou enviar o snapshot completo. A paginação de comprovativos conserva a página de oportunidades e vice-versa, através apenas dos parâmetros numéricos validados. Perfis e comprovativos anteriores mantêm-se compatíveis. Não foram introduzidos estados de contratação, alterações documentais, novos acessos ou migrações.
|
||||
|
||||
Verificação dirigida SQLite: 29 testes/488 asserções nos módulos de perfil e submissões, incluindo 21 comprovativos próprios e um de outra conta, acesso à segunda página, título preservado e projecção sem dados adicionais. Onze testes frontend, tipos, PHPStan sem erros, Pint/lint dirigidos; restantes resultados finais na prova `proofs/candidate-receipt-history.json`. Apenas local, produção ainda em bf84575. Conferência visual continua pendente por indisponibilidade do conector.
|
||||
|
||||
## Escolha preservada no registo e preparação do perfil, 30 de Outubro de 2026
|
||||
|
||||
A escolha pública segue agora tanto para a entrada como para o registo. Uma nova conta conserva uma referência à oportunidade na sessão, associada à identidade e empresa; não copia regras ou dados internos para essa referência. O perfil permite retomar o formulário depois de preparar os dados e confirmar o email, sem submissão automática. A criação da conta mantém o destino de preparação do perfil. Cada consulta reconfirma publicação, prazo e empresa; uma oportunidade retirada deixa de aparecer e produz informação genérica de indisponibilidade. Sessões com outra identidade/empresa ou referência incompleta não conservam o atalho. Sair ou concluir explicitamente a submissão remove a escolha. A confirmação de email e as restantes validações da candidatura são mantidas.
|
||||
|
||||
Validação final SQLite: 28 testes/457 asserções. PostgreSQL descartável: 68 testes/1484 asserções, incluindo o percurso registo → perfil → tentativa não confirmada recusada → submissão explícita após confirmação fictícia. Base descartável removida, sem contas, mensagens ou candidaturas reais no domínio. A verificação adicional de referência de sessão incompleta foi exercida em SQLite/análise estática. Compilação concluída com código zero; PHPStan sem erros, tipos, Pint/lint e frontend dirigidos registados na prova `proofs/candidate-registration-selection.json`. Sem novas migrações. Incremento apenas local, posterior a f5f5649; produção continua em bf84575. Conferência visual ainda pendente.
|
||||
|
||||
## Oportunidade escolhida preservada na entrada, 30 de Outubro de 2026
|
||||
|
||||
O botão de entrada de cada oportunidade guarda a escolha no formulário de login e apresenta o título escolhido. Após autenticação válida, o servidor volta a conferir publicação, empresa e prazo e encaminha para o formulário dessa oportunidade. Não aceita URLs de retorno fornecidos pelo cliente. Um identificador inexistente, de outra empresa, retirado ou expirado encaminha para o perfil com mensagem genérica de indisponibilidade. A entrada não envia a candidatura, não modifica o perfil e não dispensa confirmação de email ou requisitos documentais. Criar uma nova conta mantém o percurso de preparação do perfil anteriormente existente.
|
||||
|
||||
Verificação dirigida final SQLite: 26 testes/400 asserções. PostgreSQL descartável: 66 testes/1426 asserções sobre os percursos de candidatos e Pessoas, incluindo os novos guardas de destino; a mensagem final de indisponibilidade foi adicionalmente conferida em SQLite e no frontend. Dez testes frontend, PHPStan sem erros, tipos, Pint e lint dirigidos. Sem novas migrações ou instalação no domínio; conferência visual continua pendente. Provas integrais da release bf84575 reutilizadas, sem repetição de toda a suíte. A compilação e prova final constam em `proofs/candidate-opportunity-login.json`.
|
||||
|
||||
## Consulta de oportunidades antes do registo, 30 de Outubro de 2026
|
||||
|
||||
A entrada da área do candidato mostra oportunidades explicitamente publicadas, abertas e dentro do prazo, com título, tipo, data e descrição pública. Não expõe finalidade interna, regras, candidaturas, avaliações ou documentos. A consulta é paginada por empresa; a última versão da publicação controla a visibilidade, incluindo retirada. O fecho de novos registos mantém a consulta pública e a entrada das contas existentes. Preparar e enviar candidaturas continuam a exigir autenticação própria, perfil e confirmação de email conforme as regras já existentes.
|
||||
|
||||
A área autenticada reutiliza a mesma consulta e passa a ter paginação, em vez de omitir oportunidades depois das primeiras 20. Retirada a mensagem desactualizada de que o envio de documentos ainda não estava disponível. Não foram abertas inscrições, publicadas oportunidades ou criadas contas para testar no domínio.
|
||||
|
||||
Verificação dirigida: 24 testes PHP/374 asserções em perfil e submissões; PostgreSQL descartável: 64 testes/1401 asserções, incluindo Pessoas e formatos de documentos. Dez testes frontend dirigidos, tipos, PHPStan sem erros, Pint e lint dirigidos aprovados. As provas integrais aceites da entrega bf84575 são reutilizadas, sem alegar nova execução de toda a suíte. Conferência visual tentada novamente: conector devolveu native pipe indisponível e browser host indisponível. Este incremento continua local e não faz parte da release bf84575 activa no domínio. Provas `proofs/candidate-public-opportunities.json` e `candidate-public-opportunities-pg.json`.
|
||||
|
||||
## Entrega em produção confirmada — bf84575, 30 de Outubro de 2026
|
||||
|
||||
O commit `bf84575d10d9063c2224945e6d5627da826148a9` está em main e activo no domínio, na release `20261030-190744-bf84575d10d9-KyKKDI71`. O serviço existente terminou com Result=success e ExecMainStatus=0. Esta confirmação actualiza as indicações históricas de instalação apenas local abaixo.
|
||||
|
||||
O instalador foi corrigido para exigir HTTP 200 em `/dashboard`: o anterior teste da raiz recebia o redireccionamento público esperado e provocava rollback. A validação e o rollback do instalador foram mantidos. Configuração anterior salvaguardada antes da correcção.
|
||||
|
||||
Delta reconciliado: 14 migrações, de 000028 a 000041, sem repetir as 30 já registadas. Backup fresco da base e armazenamento, restauro conferido e ensaio das migrações na cópia antes da transacção de produção. As 81 tabelas anteriores conservaram os seus dados nas colunas de origem; 18 novas tabelas conferidas vazias e schema final igual ao ensaio. Existem agora 44 migrações registadas. A migração 000028 acrescenta o parâmetro de IVA por empresa com valor inicial 16%, sem reescrever os valores e snapshots anteriores. Não foram criadas contas, abertas inscrições ou publicadas oportunidades automaticamente.
|
||||
|
||||
Armazenamento privado em storage partilhado persistente, com escrita conferida para www-data. Limites específicos do domínio: ficheiro 50M, pedido PHP e Nginx 104M, até 20 ficheiros; configuração Nginx validada e recarregada. Os 2M/8M ainda apresentados pelo PHP CLI são os limites do terminal e não os parâmetros específicos do domínio. PHP 8.4 dispõe de DOM/ZIP/fileinfo; PHP 8.5 CLI continua sem DOM/ZIP e não foi usado na instalação.
|
||||
|
||||
Conferência HTTP: 21 ecrãs públicos com componentes esperados, utilizador nulo e âmbito vazio; sete percursos privados protegidos. Prova `proofs/candidate-documents-production.json`. Conferência visual dirigida e ensaio com candidatura real no domínio continuam pendentes; não foram enviados ficheiros pessoais ou emails reais para os simular.
|
||||
|
||||
## CV e documentos na candidatura electrónica, 30 de Outubro de 2026
|
||||
|
||||
Recepção de documentos integrada no mesmo envio da candidatura. A obrigatoriedade, formatos (PDF, DOCX, JPG e PNG) e limite por ficheiro vêm do formulário preservado na preparação do processo, sem procurar a versão actual da empresa. Recusados documentos desconhecidos, obrigatórios em falta, tamanho excessivo e divergência de extensão/MIME/conteúdo. DOCX exige estrutura Word/XML válida, sem declarações de entidades/DOCTYPE, macros ou executáveis conhecidos, com limites de entradas e expansão do arquivo. A conferência de formato não constitui antivírus, prova de autenticidade, validação do mérito ou aprovação documental.
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:09:50.960374+00:00",
|
||||
"commit": "bf84575d10d9063c2224945e6d5627da826148a9",
|
||||
"release": "/var/www/compras-deploy/releases/20261030-190744-bf84575d10d9-KyKKDI71",
|
||||
"deployment_service": "success",
|
||||
"migration_count": 44,
|
||||
"migrations_applied": 14,
|
||||
"existing_tables_preserved": 81,
|
||||
"new_tables_verified_empty": 18,
|
||||
"backup": "/root/compras-release-backups/20261030T190740921286Z-bf84575",
|
||||
"database_restore_verified": true,
|
||||
"storage_restore_verified": true,
|
||||
"private_storage_shared": true,
|
||||
"web_user_can_write_private_uploads": true,
|
||||
"nginx_validation_ok": true,
|
||||
"site_upload_configuration": [
|
||||
"\n client_max_body_size 104M;",
|
||||
" fastcgi_param PHP_VALUE \"upload_max_filesize=50M\\npost_max_size=104M\\nmax_file_uploads=20\";"
|
||||
],
|
||||
"cli_limits_apply_to_cli_only": true,
|
||||
"application": {
|
||||
"database_driver": "pgsql",
|
||||
"migration_count": 44,
|
||||
"candidate_migrations": [
|
||||
"2026_10_30_000037_create_candidate_profiles",
|
||||
"2026_10_30_000038_create_candidate_access_tokens",
|
||||
"2026_10_30_000039_create_candidate_submissions",
|
||||
"2026_10_30_000040_create_candidate_triage",
|
||||
"2026_10_30_000041_create_candidate_submission_documents"
|
||||
],
|
||||
"documents_table_exists": true,
|
||||
"document_count": 0,
|
||||
"public_navigation_enabled": true,
|
||||
"candidate_disk_root": "/var/www/compras-deploy/releases/20261030-190744-bf84575d10d9-KyKKDI71/storage/app/candidate-documents"
|
||||
},
|
||||
"http": {
|
||||
"checked_at": "2026-10-30T19:08:35.710090+00:00",
|
||||
"results": [
|
||||
{
|
||||
"path": "/",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/dashboard"
|
||||
},
|
||||
{
|
||||
"path": "/dashboard",
|
||||
"status": 200,
|
||||
"component": "dashboard",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/requisicoes",
|
||||
"status": 200,
|
||||
"component": "requisitions/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/requisicoes/criar",
|
||||
"status": 200,
|
||||
"component": "requisitions/form",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/fornecedores",
|
||||
"status": 200,
|
||||
"component": "suppliers/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/cotacoes",
|
||||
"status": 200,
|
||||
"component": "quotations/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/ordens",
|
||||
"status": 200,
|
||||
"component": "purchases/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/recepcoes",
|
||||
"status": 200,
|
||||
"component": "receipts/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/stock",
|
||||
"status": 200,
|
||||
"component": "stock/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/stock/catalogo",
|
||||
"status": 200,
|
||||
"component": "stock/catalogue",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/stock/operacoes",
|
||||
"status": 200,
|
||||
"component": "stock/operations",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/equipamentos",
|
||||
"status": 200,
|
||||
"component": "equipment/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/planeamento",
|
||||
"status": 200,
|
||||
"component": "planning/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/pessoas",
|
||||
"status": 200,
|
||||
"component": "people/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/orcamentos",
|
||||
"status": 200,
|
||||
"component": "budgets/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/facturas",
|
||||
"status": 200,
|
||||
"component": "invoices/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/pagamentos",
|
||||
"status": 200,
|
||||
"component": "payments/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/regras-investimento",
|
||||
"status": 200,
|
||||
"component": "investment/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/politica-admissao",
|
||||
"status": 200,
|
||||
"component": "purchases/admission-policy",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/politica-recomendacao",
|
||||
"status": 200,
|
||||
"component": "purchases/recommendation-policy",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/revisao-compras",
|
||||
"status": 200,
|
||||
"component": "purchase-controls/index",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/settings/appearance",
|
||||
"status": 200,
|
||||
"component": "settings/appearance",
|
||||
"anonymous": true,
|
||||
"data_scope": "none",
|
||||
"version": "d57b6033713dbe71fe3664abe9f56f4a"
|
||||
},
|
||||
{
|
||||
"path": "/pessoas/cadastro",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/pessoas/1",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/fornecedores/1/dados-bancarios",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/administracao/parametrizacao",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/relatorios",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/settings/profile",
|
||||
"status": 302,
|
||||
"location": "https://compras.tempo.co.mz/login"
|
||||
},
|
||||
{
|
||||
"path": "/candidaturas/1/submissoes/1/documentos/cv",
|
||||
"status": 401
|
||||
}
|
||||
],
|
||||
"public_pages_passed": 21,
|
||||
"private_routes_protected": 7,
|
||||
"server_activation_proof": "pending"
|
||||
},
|
||||
"visual_review": "pending",
|
||||
"real_candidate_submission_in_production": "not performed"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:18:12+00:00",
|
||||
"database": "disposable PostgreSQL",
|
||||
"application_role_reused_without_privilege_change": true,
|
||||
"result": "passed",
|
||||
"test_files": [
|
||||
"CandidateSubmissionsTest",
|
||||
"PeopleHiringTest",
|
||||
"CandidatePortalTest",
|
||||
"CandidateDocumentFormatsTest"
|
||||
],
|
||||
"original_evaluation_untouched": true,
|
||||
"database_removed": true,
|
||||
"tests": 66,
|
||||
"assertions": 1426
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:18:47.034145+00:00",
|
||||
"base_commit": "c22846b",
|
||||
"scope": [
|
||||
"selected public opportunity carried into candidate login",
|
||||
"fixed server-generated redirect after authentication",
|
||||
"company publication deadline and unknown-id recheck",
|
||||
"profile fallback with generic unavailable notice",
|
||||
"no automatic submission or registration flow changes"
|
||||
],
|
||||
"module_sqlite": {
|
||||
"tests": 26,
|
||||
"assertions": 400,
|
||||
"passed": true
|
||||
},
|
||||
"postgresql": {
|
||||
"tests": 66,
|
||||
"assertions": 1426,
|
||||
"passed": true,
|
||||
"disposable_database_removed": true,
|
||||
"final_notice_additionally_checked_in_sqlite_and_frontend": true
|
||||
},
|
||||
"frontend": {
|
||||
"tests": 10,
|
||||
"status": "passed"
|
||||
},
|
||||
"phpstan_errors": 0,
|
||||
"typescript": true,
|
||||
"pint": true,
|
||||
"lint": true,
|
||||
"build": {
|
||||
"exit_code": 0,
|
||||
"completed": true
|
||||
},
|
||||
"new_migrations": false,
|
||||
"production_installed": false,
|
||||
"visual_review": "pending; unavailable connector",
|
||||
"source_sha256": {
|
||||
"app/Http/Controllers/CandidatePortalController.php": "7866cb1c29a85761906637e3caa15f334ee67de8c212ccf4c31f07d021c61b1b",
|
||||
"resources/js/pages/candidate/entry.tsx": "3c5cae01a0ebd5c2fd65569be5d2e039cb8c3e92e784497bfe8df468bdf13bab",
|
||||
"resources/js/pages/candidate/profile.tsx": "b13aea00c82e7e35a955d598a65b5b01b3725d50a39a4b38a0b10c4ac6ef6dd2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:14:38+00:00",
|
||||
"database": "disposable PostgreSQL",
|
||||
"application_role_reused_without_privilege_change": true,
|
||||
"result": "passed",
|
||||
"test_files": [
|
||||
"CandidateSubmissionsTest",
|
||||
"PeopleHiringTest",
|
||||
"CandidatePortalTest",
|
||||
"CandidateDocumentFormatsTest"
|
||||
],
|
||||
"original_evaluation_untouched": true,
|
||||
"database_removed": true,
|
||||
"tests": 64,
|
||||
"assertions": 1401
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:15:14.138147+00:00",
|
||||
"base_commit": "bf84575d10d9063c2224945e6d5627da826148a9",
|
||||
"scope": [
|
||||
"public published opportunity discovery before candidate registration",
|
||||
"current publication deadline company and process scope",
|
||||
"public content minimisation",
|
||||
"shared public and authenticated pagination",
|
||||
"authenticated application and document guards preserved"
|
||||
],
|
||||
"module_sqlite": {
|
||||
"tests": 24,
|
||||
"assertions": 374,
|
||||
"passed": true
|
||||
},
|
||||
"postgresql": {
|
||||
"tests": 64,
|
||||
"assertions": 1401,
|
||||
"passed": true,
|
||||
"disposable_database_removed": true
|
||||
},
|
||||
"frontend": {
|
||||
"tests": 10,
|
||||
"passed": true
|
||||
},
|
||||
"typescript": true,
|
||||
"phpstan_errors": 0,
|
||||
"pint": true,
|
||||
"targeted_lint": true,
|
||||
"build": {
|
||||
"exit_code": 0,
|
||||
"completed": true
|
||||
},
|
||||
"full_suite": "reuse accepted bf84575 suite; not repeated",
|
||||
"new_migrations": false,
|
||||
"production_installed": false,
|
||||
"visual_review": "blocked by unavailable native pipe and browser host",
|
||||
"source_sha256": {
|
||||
"app/Services/CandidateSubmissions.php": "63bebd4ccb04e9bc2ab19b0701567f082831814498e83cd7e9755ba2f550f6e4",
|
||||
"app/Http/Controllers/CandidatePortalController.php": "e37a7df5933da0d9635e91180a027d1d00d5dd3d16efc15c8c36a3ad906f724d",
|
||||
"resources/js/pages/candidate/entry.tsx": "1fb6c2f3ecd7153fe677c7c8164867df22f0cdc146c0bc32d6c82a0b61cd354e",
|
||||
"resources/js/pages/candidate/profile.tsx": "3857fec4bb8c10164a13b710f95df916707ebb8e214a05117f1f530b0b7b34c5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:24:58+00:00",
|
||||
"database": "disposable PostgreSQL",
|
||||
"application_role_reused_without_privilege_change": true,
|
||||
"result": "passed",
|
||||
"test_files": [
|
||||
"CandidateSubmissionsTest",
|
||||
"PeopleHiringTest",
|
||||
"CandidatePortalTest",
|
||||
"CandidateDocumentFormatsTest"
|
||||
],
|
||||
"original_evaluation_untouched": true,
|
||||
"database_removed": true,
|
||||
"tests": 69,
|
||||
"assertions": 1515
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:25:16.477974+00:00",
|
||||
"base_commit": "86b31f2",
|
||||
"scope": [
|
||||
"all own receipts reachable beyond first twenty",
|
||||
"company and account isolated count and rows",
|
||||
"opportunity title from immutable receipt snapshot",
|
||||
"no full snapshot or account identifiers sent in list",
|
||||
"independent page parameters preserve other list position"
|
||||
],
|
||||
"module_sqlite": {
|
||||
"tests": 29,
|
||||
"assertions": 488,
|
||||
"passed": true
|
||||
},
|
||||
"postgresql": {
|
||||
"tests": 69,
|
||||
"assertions": 1515,
|
||||
"passed": true,
|
||||
"disposable_database_removed": true
|
||||
},
|
||||
"frontend": {
|
||||
"tests": 11,
|
||||
"passed": true
|
||||
},
|
||||
"typescript": true,
|
||||
"phpstan_errors": 0,
|
||||
"pint": true,
|
||||
"targeted_lint": true,
|
||||
"build": {
|
||||
"exit_code": 0,
|
||||
"completed": true
|
||||
},
|
||||
"new_migrations": false,
|
||||
"production_installed": false,
|
||||
"visual_review": "pending; unavailable connector",
|
||||
"full_suite": "accepted bf84575 full-suite proofs reused; not repeated",
|
||||
"source_sha256": {
|
||||
"app/Http/Controllers/CandidatePortalController.php": "d028b6683c87add545826480b3a097bf607c414d07a40e00f01f7a85605b3016",
|
||||
"app/Services/CandidateSubmissions.php": "22b19fd3f560f716a9512a3cc9d95c4a1c43891fae58d653e089eba374e2c529",
|
||||
"resources/js/pages/candidate/profile.tsx": "4c5f9140e816b35b484b657a17fdca29fc0b89198382dbe28810bcc062f06e38"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:21:10+00:00",
|
||||
"database": "disposable PostgreSQL",
|
||||
"application_role_reused_without_privilege_change": true,
|
||||
"result": "passed",
|
||||
"test_files": [
|
||||
"CandidateSubmissionsTest",
|
||||
"PeopleHiringTest",
|
||||
"CandidatePortalTest",
|
||||
"CandidateDocumentFormatsTest"
|
||||
],
|
||||
"original_evaluation_untouched": true,
|
||||
"database_removed": true,
|
||||
"tests": 68,
|
||||
"assertions": 1484
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"checked_at": "2026-10-30T19:22:25.916372+00:00",
|
||||
"base_commit": "f5f5649",
|
||||
"scope": [
|
||||
"selected public opportunity preserved through new candidate registration and profile preparation",
|
||||
"session choice scoped to company and account",
|
||||
"fresh publication and deadline check on profile reads",
|
||||
"selection removed on logout account mismatch withdrawal and successful submission",
|
||||
"no automatic application or email verification bypass"
|
||||
],
|
||||
"module_sqlite": {
|
||||
"tests": 28,
|
||||
"assertions": 457,
|
||||
"passed": true
|
||||
},
|
||||
"postgresql": {
|
||||
"tests": 68,
|
||||
"assertions": 1484,
|
||||
"passed": true,
|
||||
"disposable_database_removed": true
|
||||
},
|
||||
"frontend": {
|
||||
"tests": 11,
|
||||
"passed": true
|
||||
},
|
||||
"phpstan_errors": 0,
|
||||
"typescript": true,
|
||||
"pint": true,
|
||||
"targeted_lint": true,
|
||||
"build": {
|
||||
"exit_code": 0,
|
||||
"completed": true
|
||||
},
|
||||
"new_migrations": false,
|
||||
"production_installed": false,
|
||||
"visual_review": "pending; connector unavailable",
|
||||
"source_sha256": {
|
||||
"app/Http/Controllers/CandidatePortalController.php": "b54e01ef8f1013925a13c854945f60f8e360a090aa048d5627878c853c10e22d",
|
||||
"resources/js/pages/candidate/entry.tsx": "35429f08b1ce635545284b4804bde3382891f1007ff9bb74536df6a8ccc7f2cb",
|
||||
"resources/js/pages/candidate/profile.tsx": "f0ddeb382185c836fb03652b3ab498ef4a9651175ca4fcb7ff4a659d0f6bcc3a"
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,34 @@ import { Button } from '@/components/ui/button';
|
||||
export default function Entry({
|
||||
company,
|
||||
portal,
|
||||
opportunities = { data: [], prev_page_url: null, next_page_url: null },
|
||||
}: {
|
||||
company: { id: number; name: string };
|
||||
portal: { version: number; registration_open: boolean; notice: string };
|
||||
opportunities?: {
|
||||
data: {
|
||||
id: number;
|
||||
title: string;
|
||||
kind: string;
|
||||
closes_on: string;
|
||||
description: string;
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
}) {
|
||||
const login = useForm({ email: '', password: '' });
|
||||
const login = useForm({
|
||||
email: '',
|
||||
password: '',
|
||||
opportunity_id: null as number | null,
|
||||
});
|
||||
const register = useForm({
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
portal_version: portal.version,
|
||||
notice_acknowledged: false,
|
||||
opportunity_id: null as number | null,
|
||||
});
|
||||
const credentials = (form: typeof login, prefix: string) => (
|
||||
<>
|
||||
@@ -61,10 +78,86 @@ export default function Entry({
|
||||
</h1>
|
||||
<p>
|
||||
Prepare o seu perfil e candidate-se às oportunidades
|
||||
publicadas. O envio de anexos ainda está em desenvolvimento.
|
||||
Criar um perfil não constitui candidatura ou contratação.
|
||||
publicadas. Os documentos exigidos são indicados em cada
|
||||
formulário. Criar um perfil não constitui candidatura ou
|
||||
contratação.
|
||||
</p>
|
||||
<section className="space-y-3">
|
||||
<section
|
||||
className="space-y-3"
|
||||
aria-label="Oportunidades publicadas"
|
||||
>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Oportunidades publicadas
|
||||
</h2>
|
||||
{opportunities.data.length === 0 && (
|
||||
<p>Não existem oportunidades nesta página.</p>
|
||||
)}
|
||||
{opportunities.data.map((item) => (
|
||||
<article
|
||||
key={item.id}
|
||||
className="space-y-2 rounded-lg border p-4"
|
||||
>
|
||||
<h3 className="font-semibold">{item.title}</h3>
|
||||
<p>
|
||||
{item.kind === 'service'
|
||||
? 'Prestação de serviços'
|
||||
: 'Recrutamento'}{' '}
|
||||
· Prazo: {item.closes_on}
|
||||
</p>
|
||||
<details>
|
||||
<summary className="cursor-pointer underline">
|
||||
Consultar descrição publicada
|
||||
</summary>
|
||||
<p className="whitespace-pre-wrap">
|
||||
{item.description}
|
||||
</p>
|
||||
</details>
|
||||
<a
|
||||
className="inline-block underline"
|
||||
href="#candidate-login"
|
||||
onClick={() => {
|
||||
login.setData('opportunity_id', item.id);
|
||||
register.setData('opportunity_id', item.id);
|
||||
}}
|
||||
>
|
||||
Entrar para preparar a candidatura
|
||||
</a>
|
||||
</article>
|
||||
))}
|
||||
<nav
|
||||
aria-label="Páginas de oportunidades"
|
||||
className="flex gap-4"
|
||||
>
|
||||
{opportunities.prev_page_url && (
|
||||
<Link
|
||||
href={opportunities.prev_page_url}
|
||||
preserveScroll
|
||||
>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
{opportunities.next_page_url && (
|
||||
<Link
|
||||
href={opportunities.next_page_url}
|
||||
preserveScroll
|
||||
>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</section>
|
||||
<section className="space-y-3" id="candidate-login">
|
||||
{login.data.opportunity_id !== null && (
|
||||
<p>
|
||||
Oportunidade escolhida:{' '}
|
||||
{
|
||||
opportunities.data.find(
|
||||
(item) =>
|
||||
item.id === login.data.opportunity_id,
|
||||
)?.title
|
||||
}
|
||||
</p>
|
||||
)}
|
||||
<h2 className="text-xl font-semibold">Entrar</h2>
|
||||
<form
|
||||
className="space-y-3"
|
||||
|
||||
@@ -17,7 +17,10 @@ export default function Profile({
|
||||
emailDeliveryAvailable = false,
|
||||
accessStatus,
|
||||
opportunities = [],
|
||||
opportunityPagination,
|
||||
selectedOpportunity,
|
||||
submissions = [],
|
||||
submissionPagination,
|
||||
}: {
|
||||
companyId: number;
|
||||
email: string;
|
||||
@@ -26,7 +29,19 @@ export default function Profile({
|
||||
emailDeliveryAvailable?: boolean;
|
||||
accessStatus?: string | null;
|
||||
opportunities?: { id: number; title: string; closes_on: string }[];
|
||||
submissions?: { id: number; reference: string; created_at: string }[];
|
||||
opportunityPagination?: { prev: string | null; next: string | null };
|
||||
selectedOpportunity?: { id: number; title: string } | null;
|
||||
submissions?: {
|
||||
id: number;
|
||||
reference: string;
|
||||
created_at: string;
|
||||
title?: string | null;
|
||||
}[];
|
||||
submissionPagination?: {
|
||||
prev: string | null;
|
||||
next: string | null;
|
||||
total: number;
|
||||
};
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: profile.version,
|
||||
@@ -39,6 +54,24 @@ export default function Profile({
|
||||
<>
|
||||
<Head title="O meu perfil" />
|
||||
<section className="mx-auto max-w-3xl space-y-3 p-6">
|
||||
{selectedOpportunity && (
|
||||
<aside className="space-y-2 rounded-lg border p-4">
|
||||
<h2 className="font-semibold">
|
||||
Oportunidade escolhida: {selectedOpportunity.title}
|
||||
</h2>
|
||||
<p>
|
||||
Prepare o perfil e confirme o email. A candidatura
|
||||
só será enviada quando confirmar a submissão no
|
||||
formulário.
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/candidaturas/${companyId}/oportunidades/${selectedOpportunity.id}`}
|
||||
>
|
||||
Continuar a preparar esta candidatura
|
||||
</Link>
|
||||
</aside>
|
||||
)}
|
||||
<h2 className="text-xl font-semibold">
|
||||
Oportunidades publicadas
|
||||
</h2>
|
||||
@@ -52,6 +85,21 @@ export default function Profile({
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
<nav
|
||||
aria-label="Páginas de oportunidades"
|
||||
className="flex gap-4"
|
||||
>
|
||||
{opportunityPagination?.prev && (
|
||||
<Link href={opportunityPagination.prev} preserveScroll>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
{opportunityPagination?.next && (
|
||||
<Link href={opportunityPagination.next} preserveScroll>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
<h2 className="text-xl font-semibold">
|
||||
As minhas candidaturas
|
||||
</h2>
|
||||
@@ -61,10 +109,31 @@ export default function Profile({
|
||||
className="underline"
|
||||
href={`/candidaturas/${companyId}/submissoes/${item.id}`}
|
||||
>
|
||||
{item.title ? `${item.title} · ` : ''}
|
||||
{item.reference} · {item.created_at}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
{submissionPagination && (
|
||||
<p>
|
||||
{submissionPagination.total} candidatura(s) entregue(s).
|
||||
</p>
|
||||
)}
|
||||
<nav
|
||||
aria-label="Páginas dos meus comprovativos"
|
||||
className="flex gap-4"
|
||||
>
|
||||
{submissionPagination?.prev && (
|
||||
<Link href={submissionPagination.prev} preserveScroll>
|
||||
Comprovativos anteriores
|
||||
</Link>
|
||||
)}
|
||||
{submissionPagination?.next && (
|
||||
<Link href={submissionPagination.next} preserveScroll>
|
||||
Mais comprovativos
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</section>
|
||||
<main className="mx-auto max-w-3xl space-y-6 p-6">
|
||||
<p>SGC · Área do candidato</p>
|
||||
@@ -104,6 +173,13 @@ export default function Profile({
|
||||
temporária de confirmação.
|
||||
</p>
|
||||
)}
|
||||
{accessStatus === 'opportunity_unavailable' && (
|
||||
<p role="status">
|
||||
Entrou na sua conta, mas a oportunidade escolhida já não
|
||||
está disponível. Consulte as oportunidades publicadas
|
||||
acima.
|
||||
</p>
|
||||
)}
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\PurchasingRole;
|
||||
use App\Models\CandidateAccount;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Services\CandidateProfiles;
|
||||
@@ -12,6 +13,7 @@ use App\Services\RequisitionWorkflow;
|
||||
use App\Services\SubmissionForms;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -44,6 +46,115 @@ beforeEach(function () {
|
||||
'answers' => ['full_name' => 'Pessoa fictícia', 'availability_location' => $this->profile['availability']]];
|
||||
});
|
||||
|
||||
test('guests see only explicitly published public opportunity fields while submission remains authenticated', function () {
|
||||
Auth::guard('candidate')->logout();
|
||||
Auth::guard('web')->logout();
|
||||
$this->get($this->base)->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 1)
|
||||
->where('opportunities.data.0', ['id' => $this->process->id, 'title' => 'Oportunidade fictícia', 'kind' => 'service', 'closes_on' => $this->process->closes_on, 'description' => $this->publication['description']])
|
||||
->where('auth.user', null)->where('organizationAccess', null));
|
||||
$this->get($this->base.'/oportunidades/'.$this->process->id)->assertUnauthorized();
|
||||
$this->postJson($this->base.'/oportunidades/'.$this->process->id, $this->body)->assertUnauthorized();
|
||||
expect(DB::table('candidate_submissions')->count())->toBe(0);
|
||||
$this->actingAs($this->admin);
|
||||
app(CandidateSubmissions::class)->publish($this->admin, $this->process->id, [...$this->publication, 'version' => 1, 'active' => false]);
|
||||
$this->get($this->base)->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 0));
|
||||
app(CandidateSubmissions::class)->publish($this->admin, $this->process->id, [...$this->publication, 'version' => 2]);
|
||||
$this->travel(8)->days();
|
||||
$this->get($this->base)->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 0));
|
||||
});
|
||||
|
||||
test('public opportunity listing is paginated within the company and remains visible to existing users when registration closes', function () {
|
||||
$process = (array) DB::table('people_processes')->where('id', $this->process->id)->first();
|
||||
$publication = (array) DB::table('candidate_opportunity_publications')->where('people_process_id', $this->process->id)->first();
|
||||
unset($process['id'], $publication['id']);
|
||||
for ($index = 0; $index < 12; $index++) {
|
||||
$id = DB::table('people_processes')->insertGetId([...$process, 'operation_key' => (string) Str::uuid()]);
|
||||
DB::table('candidate_opportunity_publications')->insert([...$publication, 'people_process_id' => $id]);
|
||||
}
|
||||
app(CandidateProfiles::class)->configure($this->admin, ['version' => 1, 'registration_open' => false, 'notice' => 'Aviso fictício de registos temporariamente encerrados.', 'reason' => 'Encerrar novos registos no ensaio.']);
|
||||
$this->get($this->base)->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 12)->where('opportunities.total', 13)->where('opportunities.next_page_url', $this->base.'?opportunities_page=2')->where('portal.registration_open', false));
|
||||
$this->get($this->base.'?opportunities_page=2')->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 1));
|
||||
$this->get($this->base.'/perfil?opportunities_page=2')->assertInertia(fn (Assert $p) => $p->has('opportunities', 1)->where('opportunityPagination.prev', $this->base.'/perfil?opportunities_page=1')->where('opportunityPagination.next', null));
|
||||
$other = Tenant::query()->create(['name' => 'Empresa sem oportunidades']);
|
||||
$otherAdmin = User::factory()->create(['tenant_id' => $other->id, 'purchasing_role' => PurchasingRole::Admin]);
|
||||
$this->actingAs($otherAdmin);
|
||||
app(CandidateProfiles::class)->configure($otherAdmin, ['version' => 0, 'registration_open' => true, 'notice' => 'Aviso fictício da outra empresa sem oportunidades.', 'reason' => 'Configurar portal separado no ensaio.']);
|
||||
$this->get('/candidaturas/'.$other->id)->assertInertia(fn (Assert $p) => $p->has('opportunities.data', 0));
|
||||
$this->getJson($this->base.'?opportunities_page=invalid')->assertUnprocessable();
|
||||
});
|
||||
|
||||
test('candidate login opens the selected published opportunity without accepting an arbitrary redirect', function () {
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => $this->process->id, 'return_to' => 'https://example.invalid/untrusted'])
|
||||
->assertRedirect($this->base.'/oportunidades/'.$this->process->id);
|
||||
$this->get($this->base.'/oportunidades/'.$this->process->id)->assertInertia(fn (Assert $p) => $p->where('opportunity.id', $this->process->id));
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'return_to' => 'https://example.invalid/untrusted'])->assertRedirect($this->base.'/perfil');
|
||||
$other = Tenant::query()->create(['name' => 'Outra empresa do ensaio de destino']);
|
||||
$otherAdmin = User::factory()->create(['tenant_id' => $other->id, 'purchasing_role' => PurchasingRole::Admin]);
|
||||
$foreignProcess = (array) DB::table('people_processes')->where('id', $this->process->id)->first();
|
||||
$foreignPublication = (array) DB::table('candidate_opportunity_publications')->where('people_process_id', $this->process->id)->first();
|
||||
unset($foreignProcess['id'], $foreignPublication['id']);
|
||||
$foreignId = DB::table('people_processes')->insertGetId([...$foreignProcess, 'tenant_id' => $other->id, 'created_by' => $otherAdmin->id, 'operation_key' => (string) Str::uuid()]);
|
||||
DB::table('candidate_opportunity_publications')->insert([...$foreignPublication, 'tenant_id' => $other->id, 'people_process_id' => $foreignId, 'created_by' => $otherAdmin->id]);
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => $foreignId])->assertRedirect($this->base.'/perfil');
|
||||
expect(DB::table('candidate_submissions')->count())->toBe(0);
|
||||
});
|
||||
|
||||
test('login rechecks selected publication and deadline and falls back to the profile for stale destinations', function () {
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => 'https://example.invalid/untrusted'])->assertUnprocessable();
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => 2147483647])->assertRedirect($this->base.'/perfil')->assertSessionHas('candidate_access_status', 'opportunity_unavailable');
|
||||
app(CandidateSubmissions::class)->publish($this->admin, $this->process->id, [...$this->publication, 'version' => 1, 'active' => false]);
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => $this->process->id])->assertRedirect($this->base.'/perfil');
|
||||
app(CandidateSubmissions::class)->publish($this->admin, $this->process->id, [...$this->publication, 'version' => 2]);
|
||||
$this->travel(8)->days();
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => $this->process->id])->assertRedirect($this->base.'/perfil');
|
||||
expect(DB::table('candidate_submissions')->count())->toBe(0);
|
||||
});
|
||||
|
||||
test('selected opportunity survives registration and profile preparation until an explicit verified submission', function () {
|
||||
$this->post($this->base.'/sair')->assertRedirect();
|
||||
$this->postJson($this->base.'/registar', [...$this->credentials, 'email' => 'selected@example.invalid', 'opportunity_id' => $this->process->id])->assertRedirect($this->base.'/perfil');
|
||||
$this->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->where('selectedOpportunity.id', $this->process->id)->where('profile.version', 0)->where('emailVerified', false));
|
||||
$this->postJson($this->base.'/perfil', $this->profile)->assertRedirect();
|
||||
$this->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->where('selectedOpportunity.id', $this->process->id)->where('profile.version', 1));
|
||||
$this->postJson($this->base.'/oportunidades/'.$this->process->id, $this->body)->assertForbidden();
|
||||
expect(DB::table('candidate_submissions')->count())->toBe(0);
|
||||
$new = CandidateAccount::query()->where('email', 'selected@example.invalid')->firstOrFail();
|
||||
$new->setAttribute('email_verified_at', now())->save();
|
||||
$this->postJson($this->base.'/oportunidades/'.$this->process->id, $this->body)->assertRedirect()->assertSessionMissing('candidate.selected_opportunity');
|
||||
expect(DB::table('candidate_submissions')->count())->toBe(1);
|
||||
});
|
||||
|
||||
test('selection is cleared on withdrawal logout and account mismatch and malformed registration cannot create an account', function () {
|
||||
$this->postJson($this->base.'/entrar', [...$this->credentials, 'opportunity_id' => $this->process->id])->assertRedirect();
|
||||
app(CandidateSubmissions::class)->publish($this->admin, $this->process->id, [...$this->publication, 'version' => 1, 'active' => false]);
|
||||
$this->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->where('selectedOpportunity', null)->where('accessStatus', 'opportunity_unavailable'))->assertSessionMissing('candidate.selected_opportunity');
|
||||
$this->withSession(['candidate.selected_opportunity' => ['company' => $this->tenant->id, 'account' => $this->account->id + 999, 'id' => $this->process->id]])
|
||||
->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->where('selectedOpportunity', null))->assertSessionMissing('candidate.selected_opportunity');
|
||||
$this->post($this->base.'/sair')->assertSessionMissing('candidate.selected_opportunity');
|
||||
$count = CandidateAccount::query()->count();
|
||||
$this->postJson($this->base.'/registar', [...$this->credentials, 'email' => 'invalid-selection@example.invalid', 'opportunity_id' => 'https://example.invalid'])->assertUnprocessable();
|
||||
expect(CandidateAccount::query()->count())->toBe($count);
|
||||
});
|
||||
|
||||
test('all own receipts remain reachable with frozen titles and independent pagination without exposing another candidate', function () {
|
||||
$this->postJson($this->base.'/oportunidades/'.$this->process->id, $this->body)->assertRedirect();
|
||||
$receipt = (array) DB::table('candidate_submissions')->sole();
|
||||
$process = (array) DB::table('people_processes')->where('id', $this->process->id)->first();
|
||||
unset($receipt['id'], $process['id']);
|
||||
$snapshot = json_decode($receipt['snapshot'], true, 32, JSON_THROW_ON_ERROR);
|
||||
$snapshot['opportunity']['title'] = 'Título preservado no comprovativo';
|
||||
for ($index = 0; $index < 20; $index++) {
|
||||
$id = DB::table('people_processes')->insertGetId([...$process, 'operation_key' => (string) Str::uuid(), 'title' => 'Outro título actual do processo']);
|
||||
DB::table('candidate_submissions')->insert([...$receipt, 'people_process_id' => $id, 'operation_key' => (string) Str::uuid(), 'reference' => 'CAND-'.Str::uuid(), 'snapshot' => json_encode($snapshot, JSON_THROW_ON_ERROR)]);
|
||||
}
|
||||
$foreign = app(CandidateProfiles::class)->register($this->tenant->id, [...$this->credentials, 'email' => 'private-receipt@example.invalid']);
|
||||
DB::table('candidate_submissions')->insert([...$receipt, 'candidate_account_id' => $foreign->id, 'operation_key' => (string) Str::uuid(), 'reference' => 'CAND-PRIVADO']);
|
||||
$this->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->has('submissions', 12)->where('submissionPagination.total', 21)->where('submissions.0.title', 'Título preservado no comprovativo')->missing('submissions.0.snapshot')->missing('submissions.0.candidate_account_id'));
|
||||
$this->get($this->base.'/perfil?submissions_page=2&opportunities_page=2')->assertInertia(fn (Assert $p) => $p->has('submissions', 9)->where('submissionPagination.total', 21)
|
||||
->where('submissionPagination.prev', fn ($url) => str_contains($url, 'opportunities_page=2') && str_contains($url, 'submissions_page=1'))->where('submissionPagination.next', null));
|
||||
$this->getJson($this->base.'/perfil?submissions_page=-1')->assertUnprocessable();
|
||||
});
|
||||
|
||||
test('electronic submission returns a scoped receipt and preserves the actual profile and answers', function () {
|
||||
$this->get($this->base.'/oportunidades/'.$this->process->id)->assertInertia(fn (Assert $p) => $p->where('opportunity.description', 'Descrição pública fictícia da oportunidade.')->missing('opportunity.purpose')->missing('opportunity.selection'));
|
||||
$url = $this->base.'/oportunidades/'.$this->process->id;
|
||||
|
||||
@@ -62,6 +62,44 @@ test.each([true, false])(
|
||||
expect(html).not.toContain('/dashboard');
|
||||
},
|
||||
);
|
||||
test('public entry shows published opportunities and pagination while keeping application behind candidate login', () => {
|
||||
const initialPage = {
|
||||
...page,
|
||||
props: {
|
||||
...page.props,
|
||||
company: { id: 1, name: 'Empresa fictícia' },
|
||||
portal: {
|
||||
version: 1,
|
||||
registration_open: false,
|
||||
notice: 'Aviso fictício.',
|
||||
},
|
||||
opportunities: {
|
||||
data: [
|
||||
{
|
||||
id: 7,
|
||||
title: 'Serviço publicado',
|
||||
kind: 'service',
|
||||
closes_on: '2026-11-10',
|
||||
description: 'Descrição pública do serviço.',
|
||||
},
|
||||
],
|
||||
prev_page_url: null,
|
||||
next_page_url: '/candidaturas/1?opportunities_page=2',
|
||||
},
|
||||
},
|
||||
};
|
||||
const html = renderToString(
|
||||
<App initialPage={initialPage} initialComponent={Entry} />,
|
||||
);
|
||||
expect(html).toContain('Serviço publicado');
|
||||
expect(html).toContain('Descrição pública do serviço.');
|
||||
expect(html).toContain('Prestação de serviços');
|
||||
expect(html).toContain('href="#candidate-login"');
|
||||
expect(html).toContain('/candidaturas/1?opportunities_page=2');
|
||||
expect(html).not.toContain('/oportunidades/7');
|
||||
expect(html).not.toContain('anexos ainda está em desenvolvimento');
|
||||
});
|
||||
|
||||
test('candidate profile renders geography and retained version without internal evaluation controls', () => {
|
||||
const initialPage = {
|
||||
...page,
|
||||
@@ -70,6 +108,20 @@ test('candidate profile renders geography and retained version without internal
|
||||
...page.props,
|
||||
companyId: 1,
|
||||
email: 'test@example.invalid',
|
||||
submissions: [
|
||||
{
|
||||
id: 8,
|
||||
reference: 'CAND-FICTICIA',
|
||||
created_at: '2026-10-30',
|
||||
title: 'Título preservado do processo',
|
||||
},
|
||||
],
|
||||
submissionPagination: {
|
||||
prev: null,
|
||||
next: '/candidaturas/1/perfil?submissions_page=2',
|
||||
total: 21,
|
||||
},
|
||||
accessStatus: 'opportunity_unavailable',
|
||||
profile: {
|
||||
version: 3,
|
||||
data: {
|
||||
@@ -92,6 +144,38 @@ test('candidate profile renders geography and retained version without internal
|
||||
expect(html).toContain('value="Distrito fictício"');
|
||||
expect(html).toContain('value="Localidade fictícia"');
|
||||
expect(html).toContain('Guardar nova versão do perfil');
|
||||
expect(html).toContain('Título preservado do processo');
|
||||
expect(html).toContain('Mais comprovativos');
|
||||
expect(html).toContain('/candidaturas/1/perfil?submissions_page=2');
|
||||
expect(html).toContain('a oportunidade escolhida já não está disponível');
|
||||
expect(html).not.toContain('Aprovar');
|
||||
expect(html).not.toContain('/pessoas');
|
||||
});
|
||||
|
||||
test('a newly registered candidate can resume the selected opportunity after preparing the profile without automatic submission', () => {
|
||||
const initialPage = {
|
||||
...page,
|
||||
component: 'candidate/profile',
|
||||
props: {
|
||||
...page.props,
|
||||
companyId: 1,
|
||||
email: 'new@example.invalid',
|
||||
selectedOpportunity: { id: 7, title: 'Serviço escolhido' },
|
||||
profile: {
|
||||
version: 0,
|
||||
data: {
|
||||
name: '',
|
||||
phone: '',
|
||||
summary: '',
|
||||
availability: { province: '', district: '', locality: '' },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const html = renderToString(
|
||||
<App initialPage={initialPage} initialComponent={Profile} />,
|
||||
);
|
||||
expect(html).toContain('Serviço escolhido');
|
||||
expect(html).toContain('/candidaturas/1/oportunidades/7');
|
||||
expect(html).toContain('A candidatura só será enviada quando confirmar');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user