I have multiple rest endpoints for GET Apis which are slightly varying in request body and Apis should return similar response in all cases applying different filter condition (where clause) on DB table. Ex: getEmployesByDeptId, getEmployesByRoleId etc on Employee table having columns like empId, name, deptId, roleId, etc… Is it recommended in Axon to have multiple REST endpoints calling a single query handler, and single projection and using some conditional logic inside that query handler to address the variation?
You can structure it either way. Just remember that the goal of a projection is to build a view is that serves a specific purpose. So watching out that it does not get too generalized should be your goal. If you find yourself writing joins when returning data from a query, that should be the first indicator that you are starting to add complexity to handling queries.