[Etapa 9] Questão Multi-Prova — backend ms-simulado (cutover) - #166
Open
FernandoAlmeidaPinto wants to merge 47 commits into
Open
[Etapa 9] Questão Multi-Prova — backend ms-simulado (cutover)#166FernandoAlmeidaPinto wants to merge 47 commits into
FernandoAlmeidaPinto wants to merge 47 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dd/removeQuestion single-write) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…Question) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tui, getById adiciona) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ve casts) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… questoesNovo Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…over) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… questoes (cutover) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…leem questoesNovo (Regras A/C) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… leem questoesNovo (Regras B/C) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eem questoesNovo Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ions inalterado) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…actories) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tion Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…opulate de questoes Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…esNovo.questao) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…questoes (client intocado) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… no cutover) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ures) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… (+ProvaModel) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…updatedAt Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… questões) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… removido) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…te/escrita de prova/numero Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-lookup Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… recebe numero explicito) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…leanup) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e numero-sync so por input) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…Novo->questoes + unset prova/numero) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e + doc de falha) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Etapa 9 — Questão Multi-Prova (Release A.5) · backend ms-simulado
Refactor profundo do domínio Simulado:
numerosai de dentro daQuestaoe vai pro relacionamento (Prova.questoes[]/Simulado.questoes[]=[{ questao, numero }]), eQuestao.prova/numerosão removidos. Habilita reuso da mesma questão entre N provas, idiomáticas ENEM naturais (2 questões mesmo número) e stats globais.Entregue via cutover single-write (não double-write): o modelo novo entrou como campo paralelo
questoesNovo(Card 01), foi populado por migração em janela (Card 02, script0001), o código passou a ler/escrever só o novo array (Cards 03-05), e o cleanup final (Cards 07a) renomeouquestoesNovo→questoese removeu o legado.O que mudou (cards 01→07a nesta cadeia)
Prova.questoes/Simulado.questoesviram subdoc[{questao,numero}];Questaosemprova/numero.question-container.helpers.ts(add/remove/updateNumero); repositories/services/factories leem e escrevem só o novo array.updateQuestionreconcilia número no subdoc.Prova.questoes(injeta ProvaModel no QuestaoRepository):canInsertQuestion,delete,updateStatus,getAll(→provasContendo),updateClassificacao,processAnswer(ano),GetSimuladoById.executeSync+ endpointsPOST /prova/synceGET /prova/sync/report(reconstruía os arrays a partir deQuestao.prova; obsoleto no novo modelo).getAllretornaprovasContendo: [{provaId, provaNome, numero}]; sort defaultupdatedAt.Migração de dados —⚠️ IRREVERSÍVEL
Script
scripts/migrations/0002-cleanup-questoes-antigas/(bash + mongosh):$unsetarray antigo →$rename questoesNovo→questoes→$unset Questao.prova/numero+ índices reversos. Rodado pelo time, em janela, com backup mongodump obrigatório (R2/S3 ≥90d). Rollback = restaurar backup.backup → rodar 0002 (mongosh) → validate.sh → deploy ms → deploy api → deploy client. O contrato de saída muda (provasContendo, answer semprova), então não pode ir sozinho.Testes
npm run buildverde; suíte24 suites / 140 testesverde (mock-style). Migração/validate testados por script (sem harness de CI).PRs relacionados (mesma etapa, deploy conjunto): api-vcnafacul e client-vcnafacul.
🤖 Generated with Claude Code