From f3cd6c598583509077675e49b52da6ea61469528 Mon Sep 17 00:00:00 2001 From: Mathis Date: Thu, 25 Apr 2024 14:00:07 +0200 Subject: [PATCH] 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 --- src/services/category.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/category.service.ts b/src/services/category.service.ts index 1d47ea7..f78d8aa 100644 --- a/src/services/category.service.ts +++ b/src/services/category.service.ts @@ -19,7 +19,7 @@ const logger = new Logger({name: 'CategoryService'}) async function createCategory(data: IDbCategory): Promise { logger.info(`Creating a new category... (${data.display_name})`) try { - return await MysqlService.IDbCategory.insert(DbHandler, { + return await MysqlService.Category.insert(DbHandler, { id: uuidv4(), display_name: data.display_name, slug_name: data.slug_name @@ -38,7 +38,7 @@ async function createCategory(data: IDbCategory): Promise { async function getAll(): Promise> | null> { try { logger.info("Getting all categories..."); - return await MysqlService.IDbCategory.getAll(DbHandler); + return await MysqlService.Category.getAll(DbHandler); } catch (error) { logger.error(`Error getting all categories: ${error}`); return null; @@ -55,7 +55,7 @@ async function getAll(): Promise> | null> { async function getBySlug(slug: string): Promise { try { logger.info(`Getting category by slug... (${slug})`); - return await MysqlService.IDbCategory.getBySlug(DbHandler, slug); + return await MysqlService.Category.getBySlug(DbHandler, slug); } catch (error) { logger.error(`Error getting category by slug: ${error}`); return null; @@ -71,7 +71,7 @@ async function getBySlug(slug: string): Promise { async function getById(id: string):Promise { try { logger.info(`Getting category by id... (${id})`); - return await MysqlService.IDbCategory.getById(DbHandler, id); + return await MysqlService.Category.getById(DbHandler, id); } catch (error) { logger.error(`Error getting category by id: ${error}`); return null; @@ -90,7 +90,7 @@ async function getById(id: string):Promise { async function deleteCategory(id:string): Promise { try { logger.info(`Deleting category... (${id})`); - return await MysqlService.IDbCategory.delete(DbHandler, id); + return await MysqlService.Category.delete(DbHandler, id); } catch (error) { logger.error(`Error deleting category: ${error}`); return null;