Update category service functions with added getBySlug function and refactor getAllCategory to getAll. Exception handling has been improved, returning null on error.
Issue: #11
Signed-off-by: Mathis <yidhra@tuta.io>
The commit updates the 'category.service.ts' file by refactoring the UUID usage. Previously, the UUID feature was imported as a whole, but now only the v4 function is imported for efficiency. It introduces a new function 'getAllCategory' to fetch all categories. This, combined with better error handling and logging, leads to improved service reliability.
Issue: #11
Signed-off-by: Mathis <yidhra@tuta.io>
A new CategoryService has been added in the services layer. This includes a function createCategory for creating a new category using IDbCategory data. Some placeholders for future features such as get, delete and retrieve by id or slug are also included.
Issue: #11
Signed-off-by: Mathis <yidhra@tuta.io>
The changes introduce two new methods in mysql.service.ts. The getById method retrieves a category from the database using its ID while the delete method will delete a category from the database using the provided category ID. Both methods return promises.
Issue: #6
Signed-off-by: Mathis <yidhra@tuta.io>
This commit adds a getById function to the mysql.service.ts file. The added functionality allows retrieving category data from the mysql database by id. Error handling has been included for undefined or invalid id cases.
Issue: #6
Signed-off-by: Mathis <yidhra@tuta.io>
Added a new method getBySlug to retrieve a category by its slug in mysql.service.ts. Also, updated the getAll method by specifying the return type to Promise<Array<IDbCategory>> for better type checking.
Issue: #6
Signed-off-by: Mathis <yidhra@tuta.io>
This commit augments the VCS XML with "CommitMessageInspectionProfile". It enables two inspection tools: "CommitFormat" and "CommitNamingConvention", meant to enforce commit standards and conventions within the project. These tools will raise a warning when they detect a violation.
Signed-off-by: Mathis <yidhra@tuta.io>
This commit adds a new `getAll` function in the `mysql.service.ts` file, which retrieves all categories from the database. It executes a SQL query and includes error handling that either resolves with an array of category objects or rejects with an Error object.
BREAKING-CHANGE: #6
Signed-off-by: Mathis <yidhra@tuta.io>
The return types for the 'insert' and 'update' methods in mysql.service.ts have been updated to 'Promise<unknown>'. Also, detailed JSDoc comments have been added for 'insert' and 'update' methods for both User and Category entities. No functionality changes have been made.
Signed-off-by: Mathis <yidhra@tuta.io>
This update introduces changes in the 'mysql.service.ts' to allow create and update operations for categories. The 'INSERT INTO' SQL query has been adjusted from targeting `users` to `categories`. An `update` function has also been added to allow updates in category data. The import order has been rearranged for better readability.
Signed-off-by: Mathis <yidhra@tuta.io>