refactor: topic model function
This commit is contained in:
parent
8007844fa8
commit
0d22b6b38b
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user