Skip to content

Develop#60

Merged
Benevanio merged 4 commits into
masterfrom
develop
Apr 5, 2026
Merged

Develop#60
Benevanio merged 4 commits into
masterfrom
develop

Conversation

@Benevanio

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 5, 2026 13:41
@vercel

vercel Bot commented Apr 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
painel-vagas Ready Ready Preview, Comment Apr 5, 2026 1:41pm

@Benevanio Benevanio moved this from Backlog to In Progress in JobAtlas – Kanban Apr 5, 2026
@Benevanio
Benevanio merged commit 82db2e2 into master Apr 5, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in JobAtlas – Kanban Apr 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the app’s pagination UX in the frontend and adjusts the backend server entry to register Swagger docs via dynamic imports, alongside dependency updates and an added Windows installer artifact.

Changes:

  • Added Swagger dependencies and updated backend server startup to register /docs via dynamic imports (with tests updated accordingly).
  • Reworked frontend jobs pagination: numeric pagination controls, results summary, and clamped page-size behavior (1–10) with updated unit tests.
  • Added Vagas Full Setup 1.0.0.exe to the repository.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Vagas Full Setup 1.0.0.exe Adds a built Windows installer artifact to the repo.
package.json Adds Swagger deps and reformats electron-builder arch config.
package-lock.json Locks new Swagger dependencies.
frontend/src/hooks/useJobsPagination.ts Clamps page size (1–10) and changes default page size to 4.
frontend/src/components/JobsTableCard.tsx Replaces previous pagination controls with numeric pagination + arrows and adds results footer + page-size input.
frontend/src/App.tsx Removes unused jobs prop passed to JobsTableCard.
frontend/tests/unit/utils/useJobsPagination.test.ts Fixes state-update testing by using act() and adds page-size clamp coverage.
frontend/tests/unit/components/JobsTableCard.test.tsx Updates tests for new pagination UI and results summary.
backend/src/server.js Registers Swagger docs with dynamic imports; refactors startup into startServer().
backend/tests/unit/services/server.test.js Updates mocks and assertions for dynamic Swagger registration and updated middleware order.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/server.js
// Router (if used in future) works correctly.
app.use((req, res) => {
if (req.path.startsWith("/api")) {
return res.status(404).json({ error: "Rota não encontrada." });

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O fallback para rotas que começam com "/api" responde com { error: ... }, mas o restante da API usa o campo message para erros (ex.: jobsApiApp.js retorna { message: ... }). Para manter consistência com o parser de erros do frontend e com os outros endpoints, troque para { message: "Rota não encontrada." } (ou alinhe o contrato de erro em um único formato).

Suggested change
return res.status(404).json({ error: "Rota não encontrada." });
return res.status(404).json({ message: "Rota não encontrada." });

Copilot uses AI. Check for mistakes.
Comment thread backend/src/server.js
Comment on lines +17 to +24
async function registerSwaggerDocs() {
try {
const [{ default: swaggerUi }, { default: swaggerSpec }] = await Promise.all([
import("swagger-ui-express"),
import("./swagger.js"),
]);

app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registerSwaggerDocs() sempre tenta importar ./swagger.js, mas o swagger-jsdoc nesse arquivo usa caminhos baseados em process.cwd() (ex.: path.resolve("src/**/*.js")), o que pode quebrar quando o backend é iniciado via Electron a partir do workspace root. Isso pode fazer a documentação ficar vazia/sem endpoints. Sugestão: tornar o swaggerSpec independente do cwd (ex.: construir o glob relativo a import.meta.url/__dirname do backend).

Copilot uses AI. Check for mistakes.
Comment thread backend/src/server.js
Comment on lines +17 to +55
async function registerSwaggerDocs() {
try {
const [{ default: swaggerUi }, { default: swaggerSpec }] = await Promise.all([
import("swagger-ui-express"),
import("./swagger.js"),
]);

app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));
} catch (error) {
// eslint-disable-next-line no-console
console.warn("Swagger desabilitado:", error instanceof Error ? error.message : error);
}
}
//Swagger documentacao
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));

app.listen(PORT, () => {
// eslint-disable-next-line no-console
console.log(`API de vagas rodando em http://localhost:${PORT}`);
console.log(`Documentação da API em http://localhost:${PORT}/docs`);
async function startServer() {
await registerSwaggerDocs();

// ── Electron static-file serving ─────────────────────────────────────────
// When ELECTRON_STATIC_DIR is set, serve the React production build so that
// the Electron window can load everything from http://localhost:<PORT>.
const staticDir = process.env.ELECTRON_STATIC_DIR;
if (staticDir && existsSync(staticDir)) {
app.use(express.static(staticDir));

// SPA catch-all: return index.html for any non-API route so that React
// Router (if used in future) works correctly.
app.use((req, res) => {
if (req.path.startsWith("/api")) {
return res.status(404).json({ error: "Rota não encontrada." });
}
res.sendFile(path.join(staticDir, "index.html"));
});
}

app.listen(PORT, () => {
// eslint-disable-next-line no-console
console.log(`API de vagas rodando em http://localhost:${PORT}`);
console.log(`Documentação da API em http://localhost:${PORT}/docs`);
});

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesmo quando o Swagger falha ao registrar (catch em registerSwaggerDocs()), o servidor sempre faz log de Documentação da API em .../docs. Isso pode induzir a erro em produção (especialmente no Electron) quando o /docs não estiver disponível. Sugestão: só logar a URL do /docs quando o swagger for registrado com sucesso (ex.: registerSwaggerDocs() retornar boolean) ou ajustar o log para indicar que é opcional.

Copilot uses AI. Check for mistakes.
min={1}
max={10}
step={1}
className="w-14 rounded-md bg-transparent text-center font-semibold text-foreground outline-none"

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O input de itens por página está com outline-none e não adiciona nenhum estilo focus-visible/ring. Isso remove o indicador de foco do teclado, prejudicando acessibilidade. Sugestão: usar o componente Input existente ou adicionar classes focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring (ou equivalente do projeto).

Suggested change
className="w-14 rounded-md bg-transparent text-center font-semibold text-foreground outline-none"
className="w-14 rounded-md bg-transparent text-center font-semibold text-foreground outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"

Copilot uses AI. Check for mistakes.
<nav className="flex items-center gap-1 self-end md:self-auto" aria-label="Paginação">
<button
type="button"
aria-label="Pagina anterior"

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No aria-label, "Pagina" deveria ser "Página" (com acento) para manter ortografia correta em texto exposto a leitores de tela.

Copilot uses AI. Check for mistakes.

<button
type="button"
aria-label="Pagina seguinte"

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No aria-label, "Pagina" deveria ser "Página" (com acento) para manter ortografia correta em texto exposto a leitores de tela.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants