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>
This commit is contained in:
parent
325c6ec6a0
commit
f3cd6c5985
@ -19,7 +19,7 @@ const logger = new Logger({name: 'CategoryService'})
|
||||
async function createCategory(data: IDbCategory): Promise<unknown> {
|
||||
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<unknown> {
|
||||
async function getAll(): Promise<Promise<Array<IDbCategory>> | 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<Promise<Array<IDbCategory>> | null> {
|
||||
async function getBySlug(slug: string): Promise<IDbCategory | null> {
|
||||
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<IDbCategory | null> {
|
||||
async function getById(id: string):Promise<IDbCategory | null> {
|
||||
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<IDbCategory | null> {
|
||||
async function deleteCategory(id:string): Promise<unknown> {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user