token issues more for pdf preview missing

With DEV to QAS live test environment

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-08-05 20:43:16 +08:00
parent 0c7f5ccd0f
commit 141b7ab592
5 changed files with 170 additions and 26 deletions
+31 -1
View File
@@ -12,7 +12,7 @@ const { syncJunction } = require("../../utils/courses/junction.util");
const { archiveOne, archiveMany } = require("../../utils/courses/archive.util");
const { restoreOne, restoreMany } = require("../../utils/courses/restore.util");
const { permanentDeleteOne, permanentDeleteMany } = require("../../utils/courses/permanentDelete.util");
const { flattenUnits, flattenLessons, nextOrderIndex, reorderJunction } = require("../../utils/courses/hierarchy.util");
const { flattenUnits, flattenLessons, nextOrderIndex, reorderJunction, getCourseUnitIds, countCourseLessons } = require("../../utils/courses/hierarchy.util");
const { getFieldValues } = require("../../utils/fieldValues.util");
const logActivity = require('../../utils/logActivity.util');
const UserNotification = require('../../models/notifications/user_notification.mdl');
@@ -2393,6 +2393,36 @@ exports.getCoursesFlat = async (req, res) => {
}
};
// One course's structure counts, looked up by uuid — used by the Task
// requirement viewer (ViewTask.jsx) to show how many units/lessons/quizzes a
// "Read a Course" requirement actually points to, without pulling the full
// nested course tree.
exports.getCourseStructureCounts = async (req, res) => {
try {
const { uuid } = req.params;
const course = await Course.findOne({ where: { uuid, ...notDeleted }, attributes: ["course_id"] });
if (!course) return R.error(res, "Course not found.", 404);
const unitIds = await getCourseUnitIds(course.course_id);
const [lessonCount, quizCount] = await Promise.all([
countCourseLessons(course.course_id),
unitIds.length
? UnitQuiz.count({ where: { unit_id: { [Op.in]: unitIds } } })
: 0,
]);
return R.success(res, "Course structure counts retrieved.", {
unitCount: unitIds.length,
lessonCount,
quizCount,
});
} catch (err) {
console.error("[COURSE][STRUCTURE COUNTS]", err);
return R.error(res, "Could not retrieve course structure counts.", 500);
}
};
exports.getCoursesBySubscription = async (req, res) => {
try {
const { slug } = req.query;