Function overload
One implementation for many signatures.
Another approach would be to simply receive the categoriesIds
in the DTO.
After that, we could transform them to the objects mentioned in the previous solution. For better encapsulation, in the file common/util/id.util, create the function wrapId()
. We'll use a function overload to have just a single implementation, preventing the need to write two separate functions depending on the parameter (one or many ids). The tooltip adapts depending on the input provided.
What remains to be done is to, in the ProductsService
, wrap the ids and use them.
Commit - Function overload for wrapping ids
Last updated