7 Commits

Author SHA1 Message Date
041e77efcd
feat(controllers): include request param to getAll functions
Changes include the inclusion of the request parameter (`_req`) in the `getAllBrand` and `getAllCategory` functions and some code format adjustment in `category.controller.ts`. This addition allows more flexibility in handling the request if needed in the future. The `total` field has also been added to the category output to conveniently provide category count.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-29 11:29:29 +02:00
2640ebbc70
feat(controllers): add detailed comment to getBySlugCategory function
The `getBySlugCategory` function in `category.controller.ts` now has a detailed comment. The comment includes a description of the function, its parameters, and its return value.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 16:31:33 +02:00
62cb05cb33
feat(controllers): add delete and getBySlug methods in category controller
The `category.controller.ts` has been updated to handle deleting a category and retrieving a category by slug. The `deleteCategory` function takes a category slug from the request params and first checks if the category exists before attempting to delete it. While the `getBySlugCategory` function simply retrieves a category by its slug.

Issue: #12
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 15:02:46 +02:00
cd51a04aba
feat(controllers): add getAllCategory function in category controller
The getAllCategory function is added in `category.controller.ts`. This function retrieves all categories and presents an error message if it fails. Specifically, it interacts with the Category service to get all categories, logs the process, and maps each element to an {`id`, `display_name`, `slug_name`} object before sending the response.

Issue: #12
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:52:42 +02:00
bd80518b5f
refactor(controllers): remove unused import in category.controller
Remove unused import `{IDbCategory}` from `category.controller.ts`. This reduces clutter and increases code clarity in the file.

Issue: #12
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:44:24 +02:00
56a1722412
feat(controllers): add update category functionality in category controller
This commit includes the creation of an updateCategory function in the category controller which allows for existing categories to be updated. It also includes appropriate error handling and response messages. In addition, it also introduces logging for the successful creation of a category.

Issue: #12
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:42:42 +02:00
23116f4345
feat(controllers): add category creation functionality
A new controller, category.controller.ts, has been added to handle category creation.
This includes validation to prevent the creation of duplicate categories and error handling in the event of failure to create a new category.

Issue: #12
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:21:24 +02:00