Deleção segura de save e dados relacionados#30
Merged
Conversation
10 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements safe cascade deletion for saves and their related data, addressing issue #14. The implementation moves cascade deletion logic from the UI layer to the repository layer, ensuring atomicity through Dexie transactions.
Key changes:
- Added
deleteSaveCascadefunction in the repository layer to handle atomic deletion of saves and dependent records - Simplified the service and UI hook to use the new cascade deletion method
- Added comprehensive unit tests for the cascade deletion functionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/infra/repositories/saves.repo.ts | Implements atomic cascade deletion using Dexie transactions |
| src/services/save/deleteSave.service.ts | Updated to use the new cascade deletion repository method |
| src/ui/hooks/save/useDeleteSave.ts | Simplified by removing redundant deletion calls |
| tests/unit/repos/deleteSaveCascade.repo.test.ts | Added unit tests for cascade deletion behavior |
| package.json | Version bump to 0.1.10 |
| docs/pr/new_pr.md | Added PR documentation |
| .github/agents/Ajudante.agent.md | Documented cascade deletion policy and test commands |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ds with tests and documentation
…y and testability
… RPG-Kings repository
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Deleção segura de save e dados relacionados
Link da issue relacionada: #14
Versão (opcional)
Descrição (resumo)
savena camada de repositório (repo), garantindo que registros dependentes (ex.:sheets,stats,inventories,xp_records) sejam removidos de forma atômica dentro de uma transação Dexie. O serviço de deleção passou a utilizar esse método e o hook de UI foi simplificado para apenas chamar o serviço. Foram adicionados testes unitários cobrindo o comportamento e documentada a política de deleção em cascata.ui > hook > service > repo > db.Destaques
deleteSaveCascade(id: string)emsrc/infra/repositories/saves.repo.tsque executa a remoção atômica dos stores relacionados.src/services/save/deleteSave.service.tspara usar a nova função de cascata.src/ui/hooks/save/useDeleteSave.tspara chamar apenas o serviço de deleção.tests/unit/repos/deleteSaveCascade.repo.test.tscobrindo remoção em cascata..github/agents/Ajudante.agent.mdcom política de deleção em cascata e comandos oficiais de teste.Breaking Changes
Checklist
.github/agents/Ajudante.agent.md)package.jsonatualizado (se aplicável)Closes #14)Observações para revisão:
db.transaction('rw', [...stores], async () => { ... })) e a cobertura dos testes unitários.Branch:
feat/14-delecao-em-cascata