-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent
createCategory
function from adding an existing category
Change `$push` operation to `$addToSet` in `createCategory` function for avoiding duplicating existing categories, And make the function returns `null` if the incoming category is already exist. Add "if" statement to `products_createCategory_post` route handler to check if the respond of `createCategory` function equals `null` for returning an error with "The category already exist" message.
- Loading branch information
1 parent
0b4113b
commit 8d106e4
Showing
2 changed files
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters