This commit adds a new controller, `ModelController`, to the controllers directory. This controller includes create, read, update and delete (CRUD) methods for handling 'model' related operations. Each method incorporates appropriate error handling and logging.
Issue: #28
Signed-off-by: Mathis <yidhra@tuta.io>
In the brand controller file, a comment was added indicating a future enhancement to implement the functionality that fetches all models of a specific brand.
Signed-off-by: Mathis <yidhra@tuta.io>
This commit introduces a new `BrandController` in the controllers folder, offering key Create, Read, Update, and Delete (CRUD) operations. This includes `createBrand`, `updateBrand`, `getBySlugBrand`, `getAllBrand`, and `deleteBrand` methods, providing better control and operation of brands within the application.
Issue: #14
Signed-off-by: Mathis <yidhra@tuta.io>
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>
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>
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>
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>
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>
- Revised comments replacing 'TODO' with 'FIX' and 'FEAT' in AuthController.
- Renamed 'AuthController.ts' to 'auth.controller.ts' and updated the reference in the router.
- Planned for implementing re-auth by current password in case of password change.
Signed-off-by: Mathis <yidhra@tuta.io>
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>