Skip to content

feat: the last bug#68

Merged
icrcode merged 1 commit into
mainfrom
dev-last-bug
Jun 21, 2026
Merged

feat: the last bug#68
icrcode merged 1 commit into
mainfrom
dev-last-bug

Conversation

@icrcode

@icrcode icrcode commented Jun 21, 2026

Copy link
Copy Markdown
Owner

This pull request introduces functionality to ensure that all coordinators with an associated course in the usuarios table are properly linked in the coordenadores_cursos join table. It adds both a migration to backfill missing links and updates the application logic to maintain this relationship when creating or updating users. The main changes are grouped below:

Database Migration & Data Consistency

  • Added migration 005_backfill_coordenadores_cursos.sql to insert missing coordinator-course links for coordinators with a curso_id in the usuarios table, ensuring data consistency between the two tables.

Repository Layer Enhancements

  • Added the vincularCoordenadorAoCurso function to cursos/repositorio.ts, providing an idempotent way to link a coordinator to a course in the coordenadores_cursos table.

API Logic Updates

  • Modified user creation (POST /usuarios) to automatically link a new coordinator to a course in coordenadores_cursos if both perfil is 'coordenador' and curso_id is provided.
  • Modified user update (PUT /usuarios/:id) to ensure any updated coordinator with a curso_id is also linked in coordenadores_cursos.
  • Imported the new linking function in usuarios/rotas.ts to support the above logic.…ação para re-sincronização

@icrcode icrcode self-assigned this Jun 21, 2026
@icrcode icrcode added the bug Something isn't working label Jun 21, 2026
@icrcode
icrcode requested a review from icrcode-senai June 21, 2026 20:56
@sonarqubecloud

Copy link
Copy Markdown

@icrcode
icrcode merged commit 1cda203 into main Jun 21, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Valida Ai Roadmap Jun 21, 2026
@icrcode
icrcode deleted the dev-last-bug branch June 21, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant