From 0d22b6b38b42c35c3fff5cc56d9049195c14d980 Mon Sep 17 00:00:00 2001 From: elangptra Date: Wed, 2 Oct 2024 14:04:17 +0700 Subject: [PATCH] refactor: topic model function --- controllers/contentControllers/topic.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/contentControllers/topic.js b/controllers/contentControllers/topic.js index 16f41d2..10da6a6 100644 --- a/controllers/contentControllers/topic.js +++ b/controllers/contentControllers/topic.js @@ -32,9 +32,9 @@ export const getTopicBySectionId = async (req, res) => { const { sectionId } = req.params; const sectionExists = await models.Section.findByPk(sectionId); - if (!sectionExists) { - return response(404, null, "Section not found", res); - } + // if (!sectionExists) { + // return response(404, null, "Section not found", res); + // } const topics = await models.Topic.findAll({ where: { ID_SECTION: sectionId }, @@ -167,6 +167,7 @@ export const getCompletedTopicsBySection = async (req, res) => { "ID_SECTION", "NAME_SECTION", "DESCRIPTION_SECTION", + "THUMBNAIL", ], }, ], @@ -204,6 +205,7 @@ export const getCompletedTopicsBySection = async (req, res) => { ID_SECTION: section.ID_SECTION, NAME_SECTION: section.NAME_SECTION, DESCRIPTION_SECTION: section.DESCRIPTION_SECTION, + THUMBNAIL: section.THUMBNAIL, TOTAL_TOPICS: totalTopicsInSection, COMPLETED_TOPICS: 0, };