mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -1320,12 +1320,12 @@ exports.getLessonByUuid = async (req, res) => {
|
||||
model: Unit,
|
||||
as: "units",
|
||||
where: notDeleted, required: false,
|
||||
attributes: ["unit_id", "uuid", "title"],
|
||||
attributes: ["unit_id", "uuid", "title", "duration_seconds"],
|
||||
through: { attributes: ["order_index"] },
|
||||
include: [{
|
||||
model: Course, as: "courses",
|
||||
where: notDeleted, required: false,
|
||||
attributes: ["course_id", "title", "subscription"],
|
||||
attributes: ["course_id", "title", "subscription", "duration_seconds"],
|
||||
through: { attributes: [] },
|
||||
}],
|
||||
},
|
||||
@@ -1360,7 +1360,7 @@ exports.getLessonByUuid = async (req, res) => {
|
||||
objectives: plain.objectives ?? [],
|
||||
status: progress?.status ?? "not_started",
|
||||
completed_at: progress?.completed_at ?? null,
|
||||
unit: firstUnit ? { unit_id: firstUnit.unit_id, uuid: firstUnit.uuid, title: firstUnit.title, course: firstUnit.courses?.[0] ?? null } : null, // back-compat singular field
|
||||
unit: firstUnit ? { unit_id: firstUnit.unit_id, uuid: firstUnit.uuid, title: firstUnit.title, duration_seconds: firstUnit.duration_seconds, course: firstUnit.courses?.[0] ?? null } : null, // back-compat singular field
|
||||
units: plain.units ?? [],
|
||||
};
|
||||
return R.success(res, "Lesson retrieved.", data);
|
||||
|
||||
Reference in New Issue
Block a user