Skip to content

feat(prequire): adicionar itens, refatorar hooks e implementar filtragem preRequire#34

Merged
StephHoel merged 7 commits into
mainfrom
develop
Dec 8, 2025
Merged

feat(prequire): adicionar itens, refatorar hooks e implementar filtragem preRequire#34
StephHoel merged 7 commits into
mainfrom
develop

Conversation

@StephHoel
Copy link
Copy Markdown
Owner

Versão (opcional)

  • Versão (SemVer): 1.0.1
  • Data: 2025-12-07

Descrição (resumo)

  • Aplica mudanças da branch develop para integração: adição de itens (nanotraje, mochila, pasta_notebook), refatoração de hooks (useFetch, useGetScene), implementação de lógica de filtragem preRequire e testes unitários correlatos.
  • Remoção de testes de depuração residuais.

Destaques

  • Adiciona novos itens ao enum e seeds
  • Implementa useFetch e refatora useGetScene para não usar react-query
  • Implementa matchesPreRequire e atualiza getScenesByPreRequire
  • Adiciona testes puros para lógica de preRequire (xpRequired, statsRequired, itemsRequired.any as OR)
  • Remove arquivo de debug de testes

Breaking Changes

  • Nenhum breaking change conhecido. Se houver migrações locais de IndexedDB, as migrations já existentes tratam compatibilidade.

Checklist

  • Testes adicionados/atualizados
  • Documentação atualizada (docs/CHANGELOG.md se aplicável)
  • package.json atualizado (se aplicável)

Observações para revisão:

  • Verifique a lógica matchesPreRequire (especialmente itemsRequired.any que agora funciona como OR).
  • Recomenda-se executar npm run test:unit e npm run tsc localmente antes do merge.

@StephHoel StephHoel requested a review from Copilot December 8, 2025 00:26
@StephHoel StephHoel self-assigned this Dec 8, 2025
@StephHoel StephHoel added the area/api Área: API/serviços label Dec 8, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 implements preRequire filtering logic for scene selection, refactors hooks to remove react-query dependency for scene fetching, and adds three new items to the game. The changes support more flexible scene matching based on requirements like XP, stats, items, and skills.

  • Implements matchesPreRequire utility function with support for OR-style itemsRequired.any matching
  • Refactors useGetScene to use new useFetch hook instead of react-query
  • Adds three new items: nanotraje, mochila, and pasta_notebook

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/unit/infra/repositories/scenesList.repo.test.ts Adds unit tests for matchesPreRequire filtering logic with various preRequire scenarios
tests/unit/infra/repositories/matchRequired.test.ts Adds comprehensive unit tests for individual matchesPreRequire conditions
src/ui/hooks/useFetch.ts Implements new generic useFetch hook for data fetching without react-query
src/ui/hooks/scene/useGetScene.ts Refactors scene fetching to use useFetch instead of useQuery
src/services/stats/createStats.service.ts Refactors resource initialization to use new defaultResourceNormalized helper
src/services/sheet/createSheet.service.ts Simplifies sheet creation by inlining object construction
src/infra/repositories/scenesList.repo.ts Implements matchesPreRequire filtering in getScenesByPreRequire
src/infra/dexie/seed/stats_base.seed.ts Removes obsolete TODO comments
src/infra/dexie/seed/items.seed.ts Adds three new item definitions with descriptions and properties
src/infra/dexie/migrations/v1-to-v2.migration.ts Removes obsolete TODO comment
src/domain/utils/index.ts Exports new matchRequired utilities
src/domain/utils/game/matchRequired.ts Implements core matching logic for preRequire filtering
src/domain/utils/format/resource.ts Adds defaultResourceNormalized helper function
src/domain/types/queryResult/fetchResult.type.ts Defines types for new useFetch hook
src/domain/types/index.ts Exports new fetch result types
src/domain/queryKeys.ts Removes deprecated scene query key
src/domain/constants/enum/item.enum.ts Adds three new item enum entries
package.json Bumps version to 1.0.1
docs/kanban.md Marks TODO resolution tasks as completed

Comment thread src/ui/hooks/useFetch.ts
Comment thread src/domain/utils/game/matchRequired.ts
Comment thread src/domain/utils/game/matchRequired.ts
Comment thread src/services/stats/createStats.service.ts
Comment thread tests/unit/infra/repositories/scenesList.repo.test.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@StephHoel StephHoel merged commit 18049fe into main Dec 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Área: API/serviços

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants