diff --git a/src/controllers/brand.controller.ts b/src/controllers/brand.controller.ts index d716367..9ae4c74 100644 --- a/src/controllers/brand.controller.ts +++ b/src/controllers/brand.controller.ts @@ -92,12 +92,13 @@ async function getBySlugBrand(req: Request, res: Response): Promise { } /** - * Retrieves all brands and sends the response. + * Retrieves all brands. * + * @param {Request} _req - The request object. * @param {Response} res - The response object. - * @returns {Promise} - A Promise that resolves with the response object. + * @returns {Promise} - A promise with the response object. */ -async function getAllBrand(res: Response): Promise { +async function getAllBrand(_req: Request, res: Response): Promise { const brands = await BrandService.getAll(); if (!brands) { logger.error("Failed to retrieve brands"); diff --git a/src/controllers/category.controller.ts b/src/controllers/category.controller.ts index fe603bd..0c3d93c 100644 --- a/src/controllers/category.controller.ts +++ b/src/controllers/category.controller.ts @@ -97,24 +97,27 @@ async function deleteCategory(req: Request, res: Response): Promise { /** * Retrieves all categories. * + * @param _req * @param {Response} res - The response object. * @return {Promise} - A promise that resolves to the response object. */ -async function getAllCategory(res: Response): Promise { +async function getAllCategory(_req: Request, res: Response): Promise { const categories = await CategoryService.getAll(); if (!categories) { logger.error("Failed to get categories"); return res.status(500).json({ error: "Failed to get categories" }); } logger.info("Categories retrieved successfully"); - //ToTest categories output type - return res.status(200).json({ + return res + .status(200) + .json({ iat: Date.now(), categories: categories.map((category: IDbCategory) => ({ id: category.id, display_name: category.display_name, slug_name: category.slug_name - })) + })), + total: categories.length }); }