mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
chore: relocate backend into apps/api ahead of monorepo merge
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/***********************************************************************************************************************************************************************
|
||||
* File Name: unit_lessons.mdl.js
|
||||
* Type of Program: Model (junction)
|
||||
* Description: Attaches a standalone Lesson to a Unit. A Lesson can live in many
|
||||
* Units; per-unit ordering lives here (order_index), not on the
|
||||
* Lesson itself. Detaching removes the row — the Lesson survives.
|
||||
*
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jul. 7, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
const { DataTypes } = require("sequelize");
|
||||
const sequelize = require("../../config/db.config");
|
||||
|
||||
const UnitLesson = sequelize.define("UnitLesson", {
|
||||
unit_lesson_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
|
||||
unit_id: { type: DataTypes.BIGINT, allowNull: false },
|
||||
lesson_id: { type: DataTypes.BIGINT, allowNull: false },
|
||||
order_index: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
createdBy: { type: DataTypes.BIGINT, allowNull: true },
|
||||
updatedBy: { type: DataTypes.BIGINT, allowNull: true },
|
||||
}, {
|
||||
tableName: "unit_lessons",
|
||||
timestamps: true,
|
||||
indexes: [
|
||||
{ unique: true, fields: ["unit_id", "lesson_id"], name: "uq_unit_lessons_unit_lesson" },
|
||||
{ fields: ["unit_id"], name: "idx_unit_lessons_unit_id" },
|
||||
{ fields: ["lesson_id"], name: "idx_unit_lessons_lesson_id" },
|
||||
{ fields: ["order_index"], name: "idx_unit_lessons_order" },
|
||||
],
|
||||
});
|
||||
|
||||
module.exports = UnitLesson;
|
||||
Reference in New Issue
Block a user