Skip to content

Separate endpoints for active vs all categories #121

@iRahmanG

Description

@iRahmanG

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:

  1. Create a new category.
  2. Delete it using /delete/{id} (soft delete).
  3. Call /getallcategories.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions