mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ordered models for lessons and units
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -57,8 +57,9 @@ async function recomputeParentDurations(lessonId) {
|
|||||||
const LESSON_LIST_COMPUTED = [
|
const LESSON_LIST_COMPUTED = [
|
||||||
{
|
{
|
||||||
key: "course_count",
|
key: "course_count",
|
||||||
label: "Used in courses",
|
label: "Affiliated",
|
||||||
type: "number",
|
type: "number",
|
||||||
|
order: 2, // 1: Title, 2: Affiliated, 3: Course Status — see lessons.mdl.js
|
||||||
literal: `(
|
literal: `(
|
||||||
SELECT CAST(COUNT(DISTINCT c.course_id) AS INTEGER)
|
SELECT CAST(COUNT(DISTINCT c.course_id) AS INTEGER)
|
||||||
FROM unit_lessons ul
|
FROM unit_lessons ul
|
||||||
@@ -72,6 +73,7 @@ const LESSON_LIST_COMPUTED = [
|
|||||||
key: "course_status",
|
key: "course_status",
|
||||||
label: "Course Status",
|
label: "Course Status",
|
||||||
type: "text",
|
type: "text",
|
||||||
|
order: 3, // 1: Title, 2: Affiliated, 3: Course Status — see lessons.mdl.js
|
||||||
filterable: false,
|
filterable: false,
|
||||||
literal: `(
|
literal: `(
|
||||||
CASE
|
CASE
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ const UNIT_LIST_COMPUTED = [
|
|||||||
key: "course_status",
|
key: "course_status",
|
||||||
label: "Course Status",
|
label: "Course Status",
|
||||||
type: "text",
|
type: "text",
|
||||||
|
order: 3, // 1: Title, 2: Affiliated, 3: Course Status, 4: Subscription, 5: Duration — see units.mdl.js
|
||||||
filterable: false,
|
filterable: false,
|
||||||
literal: `(
|
literal: `(
|
||||||
CASE
|
CASE
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ const Lesson = sequelize.define("Lesson", {
|
|||||||
uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0 },
|
uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0 },
|
||||||
|
|
||||||
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1 },
|
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1 },
|
||||||
description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 2 },
|
// order 2 is reserved for the computed "Affiliated" (course_count) column, order 3 for computed "Course Status" — see LESSON_LIST_COMPUTED in lessons.controller.js
|
||||||
|
description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0 },
|
||||||
|
|
||||||
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 }, // computed from blocks on save
|
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0 }, // computed from blocks on save
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ const Unit = sequelize.define("Unit", {
|
|||||||
unit_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true, hidden: true, order: 0, filterable: false },
|
unit_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true, hidden: true, order: 0, filterable: false },
|
||||||
uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0, filterable: false },
|
uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0, filterable: false },
|
||||||
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1, filterable: true },
|
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1, filterable: true },
|
||||||
// order 2 is reserved for the computed "Affiliated" (course_count) column — see UNIT_LIST_COMPUTED in units.controller.js
|
// order 2 is reserved for the computed "Affiliated" (course_count) column, order 3 for computed "Course Status" — see UNIT_LIST_COMPUTED in units.controller.js
|
||||||
subscription: { type: DataTypes.STRING(50), allowNull: true, label: "Subscription", hidden: false, order: 3, filterable: true, comment: "Optional direct tier gate for standalone units — null means open (or gated only via an attached course)." },
|
subscription: { type: DataTypes.STRING(50), allowNull: true, label: "Subscription", hidden: false, order: 4, filterable: true, comment: "Optional direct tier gate for standalone units — null means open (or gated only via an attached course)." },
|
||||||
description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0, filterable: false },
|
description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0, filterable: false },
|
||||||
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 4, filterable: false },
|
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 5, filterable: false },
|
||||||
createdBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
createdBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||||
updatedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
updatedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||||
deletedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
deletedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||||
|
|||||||
Reference in New Issue
Block a user