Listagens públicas devem exibir apenas produtos e categorias ativos

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java, spring-boot

Research direction

Start with ProductRepository.java and CategoryService.java to trace the public listings, then read ProductService.java and the linked ResourceServerConfig.java for ID lookups and access rules. Decide the behavior for inactive items, roles, and products in inactive categories, then cover those decisions with integration tests. Update API-ENDPOINTS.md and DATA-ACCESS.md; done means the documented rules and acceptance criteria are tested.

Written by the indexing model from the issue text.

Description

enhancement

Contexto

Produtos e categorias têm o indicador active, mas as entidades só armazenam o valor, sem aplicar nenhuma regra com base nele (DOMAIN-MODEL.md).

As rotas GET /api/v1/products/** e GET /api/v1/categories/** são públicas (ResourceServerConfig.java:81), e nenhuma consulta filtra pelo active:

Por isso, um produto ou uma categoria desativados por PATCH /{id}/deactivate continuam aparecendo para o frontend.

O que fazer

  • Filtrar por active = true nas listagens públicas de produtos e de categorias.
  • Decidir e documentar:
    • se ADMIN e OPERATOR continuam vendo os itens inativos (por exemplo, por um parâmetro ou por uma rota de gestão);
    • o que o GET /{id} público responde para um item inativo;
    • se um produto ativo que só pertence a categorias inativas deve aparecer.

Critérios de aceite

  • GET /api/v1/products sem token não devolve produtos inativos, inclusive com os filtros name e categoryIds.
  • GET /api/v1/categories sem token não devolve categorias inativas.
  • O comportamento do GET /{id} para itens inativos está definido e coberto por teste.
  • A forma como ADMIN e OPERATOR acessam os itens inativos está definida e testada.
  • Testes de integração cobrindo as listagens com itens ativos e inativos.
  • API-ENDPOINTS.md e DATA-ACCESS.md atualizados.
Dominant language
Java
Stars
1
Forks
1
Avg merge
2d 1h
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Albertinesilva/backend-engineering-journey-java-springboot

All issues in Albertinesilva/backend-engineering-journey-java-springboot

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.