11 Commits

Author SHA1 Message Date
56bfd8cd0d
type: style
scope: services, interfaces

subject: Apply code formatting

- Correct indentation and formatting to match code style standards in multiple 'interfaces' and 'services' files.
- Also ensure lines at the end of the files.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-30 10:55:37 +02:00
a811a2ece2
docs(services): add tasks to MySQL and Category services
An additional task is marked in the MySQL service to check if models are linked before taking further actions. Similarly, in the Category service, two tasks are added to verify the existence of a category and elements linked to it before proceeding with deletion.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-26 09:57:44 +02:00
debb30b896
refactor(services): remove duplicate comments in category.service.ts
Duplicate comments were found and removed from `category.service.ts`. This refactoring step will make the code cleaner and less confusing.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 16:57:10 +02:00
ab3b3c9cf5
feat(services): add updateCategory functionality in category.service
This commit includes the addition of a new function, `updateCategory` in the category.service.ts file. This function allows for updating a category in the database. Error handling and logging are also implemented within the function.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:43:41 +02:00
a582f8c431
docs(services): add comment for future improvement in category service
A comment has been added in the category service to return the new id in the future. Currently, the implementation returns a boolean value after creating a new category, but there is a plan to update this to return the generated id.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:22:02 +02:00
4a9bc402b4
feat(services): change return type in createCategory function
The return type of the createCategory function in category.service.ts has been changed from unknown to boolean. Now, the function will return true if the creation is successful, and false if an error occurs.

Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:11:15 +02:00
f3cd6c5985
fix(services): correct MysqlService method calls in category.service.ts
Several method calls in category.service.ts were incorrectly using IDbCategory instead of Category in MysqlService. This commit fixes the naming to correctly use Category in all method calls to ensure correct function execution.

Issue: #11
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 14:00:07 +02:00
325c6ec6a0
feat(services): update methods in category service
Refactor the category service by:
- Calling methods from MysqlService.IDbCategory instead of MysqlService.Category.
- Adding new methods: getById and deleteCategory with typed return and clear comments.
These changes enhances code flexibility and readability.

Issue: #11
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-25 13:55:55 +02:00
11be3a40c3
feat(services): update category service functions
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>
2024-04-25 13:50:45 +02:00
3d3bc8580a
feat(services): update category.service with improved UUID usage and new function
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>
2024-04-25 13:46:08 +02:00
38b6b05190
feat(services): add CategoryService with createCategory function
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>
2024-04-25 13:33:09 +02:00