Currently, the getAllCategories endpoint returns all categories, including those marked as soft‑deleted (isDelete = true). This can cause confusion because normal users usually expect only active categories, while admins may want to see everything.
Steps to reproduce:
- Create a new category.
- Delete it using /delete/{id} (soft delete).
- Call /getallcategories.
- The deleted category still appears in the list.
Expected behavior:
- Normal users should only see active categories (isDelete = false).
- Admins should have a way to fetch all categories, including deleted ones.
Suggested improvement:
- Keep /getallcategories for admin use (returns everything).
- Add a new endpoint /categories (or /activecategories) that only returns active categories.
- Repository example for active categories:
Page<Category> findByIsDeleteFalse(Pageable pageable);
- Service method should use this query for the active categories endpoint.
Why this matters:
- Makes the API behavior clear and predictable.
- Prevents confusion for frontend clients who expect deleted categories to be hidden.
- Still allows admins to audit or restore deleted categories when needed.
Currently, the getAllCategories endpoint returns all categories, including those marked as soft‑deleted (isDelete = true). This can cause confusion because normal users usually expect only active categories, while admins may want to see everything.
Steps to reproduce:
Expected behavior:
Suggested improvement:
Page<Category> findByIsDeleteFalse(Pageable pageable);Why this matters: