This commit is contained in:
@@ -11,7 +11,7 @@ class ContextController {
|
||||
*/
|
||||
async createContext(req, res, next) {
|
||||
try {
|
||||
const { title, desc, grade, type } = req.body;
|
||||
const { title, desc, grade, type, type_image , reference_id } = req.body;
|
||||
|
||||
// Validate required fields
|
||||
if (!title || !desc || !grade) {
|
||||
@@ -35,9 +35,11 @@ class ContextController {
|
||||
desc,
|
||||
grade: gradeNum,
|
||||
type: type || 'general',
|
||||
type_image: type_image || null,
|
||||
status: 0, // Draft
|
||||
context: '',
|
||||
knowledge: ''
|
||||
knowledge: '',
|
||||
reference_id: reference_id || null
|
||||
});
|
||||
|
||||
res.status(201).json({
|
||||
|
||||
@@ -17,6 +17,8 @@ class LessonController {
|
||||
is_published,
|
||||
is_free,
|
||||
lesson_type,
|
||||
lesson_content_type,
|
||||
chapter_id,
|
||||
search
|
||||
} = req.query;
|
||||
|
||||
@@ -24,6 +26,9 @@ class LessonController {
|
||||
const where = {};
|
||||
|
||||
// Filters
|
||||
if (chapter_id) {
|
||||
where.chapter_id = chapter_id;
|
||||
}
|
||||
if (is_published !== undefined) {
|
||||
where.is_published = is_published === 'true';
|
||||
}
|
||||
@@ -33,6 +38,9 @@ class LessonController {
|
||||
if (lesson_type) {
|
||||
where.lesson_type = lesson_type;
|
||||
}
|
||||
if (lesson_content_type) {
|
||||
where.lesson_content_type = lesson_content_type;
|
||||
}
|
||||
if (search) {
|
||||
where.lesson_title = { [Op.like]: `%${search}%` };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user