Repository navigation
fix(entries): preservar status agendado e adicionar --scope no update - #66
Merged
Merged
Conversation
A scheduled occurrence was always sent back with confirmado: true and a filled-in dataEfetiva/valorEfetivo, which confirmed it and detached it from its series. It now stays scheduled unless --pending or --reconciled is passed. --scope this|following maps to the API's todos flag, a warning on stderr explains that editing a series occurrence without --scope changes only it, and the summary prints the status the API answered with. Refs #65
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.
Refs #65
O que muda
agendadocontinua agendado ao ser editado. O PUT vai comstatus: { confirmado: false, conciliado: false }e sem preencherdataEfetiva/valorEfetivo(manda só o que o lançamento já tinha, normalmente nada). Antes ia sempreconfirmado: truecom data/valor efetivos, o que confirmava a ocorrência e tirava ela da série. O status só muda com flag explícita:--pending(confirma sem conciliar) ou--reconciled. O mesmo vale para transferências agendadas (não mandadataEfetiva/valorEfetivo/valorEfetivoT).--scope this|following(padrãothis): viratodos: false|trueno corpo do PUT. É o "Apenas neste" / "Neste e em todos na sequência" da web (lanc.todos = (alteracao == 2)nojs/md.js). Pelo teste real do Filipe,todos: truealtera esta ocorrência e as seguintes, e o servidor divide a série.todossó vai para ocorrências de série (agendaId+parcela, mesma regra da web). Fora de série,--scope followingdá erro antes do PUT. Valor inválido é rejeitado pelo Commander.--scope, sai no stderr um aviso de que só esta ocorrência será alterada e sairá da série. O stdout do--jsoncontinua JSON válido.conciliado/pendente/agendado, ou o objeto{confirmado, conciliado}), e não mais "Scheduled" como fallback fixo. Para série, imprime também o escopo.agenda.primeiraDataacompanha a nova data.Testes
test/entries-update-series.test.ts(7 testes) confere o payload que chegou ao mock com literais:status, ausência dedataEfetiva/valorEfetivo,todos,agenda.primeiraData,--pendingconfirmando, transferência agendada, entrada fora de série e--scopeinválido. Confere também o aviso no stderr e o status impresso.scripts/mock-api.ts): nova ocorrência agendada80(NuCel,fixa). O PUT deriva o status do objeto enviado e, como a API real, tratadataEfetivapreenchida como confirmação. A ocorrência só fica na série comtodos: true, etodosem lançamento fora de série dá 400. Os seeds foram parascripts/mock-entries.tspor causa domax-lines.verify.shganha 6 passos E2E: agendado mantém status, aviso no stderr,--scope followingem JSON e texto,--pendingconfirma e--scopefora de série falha.Verificação
scripts/verify.shlocal → VERIFICAÇÃO OK (127 testes, exit 0). Nada foi testado contra a API real.