/*********************************************************************************************************************************************************************** * File Name: plan_lessons.mdl.js * Type of Program: Model * Description: Junction table — links standalone Lessons to a specific tier plan. * Composite UNIQUE on (plan_id, lesson_id) only prevents adding * the same lesson twice to the same plan — a lesson may belong * to many plans simultaneously (Tier Plans v2, silent duplication * across bundles is intentional; see admin/tiers.controller.js). * Mirrors plan_courses.mdl.js — bundling/display only, not an * access-control mechanism (see canAccessLesson / user_tier_grants). * Author: Kenneth Obsequio (@lash0000) * Date Created: Aug. 1, 2026 ***********************************************************************************************************************************************************************/ const { DataTypes } = require('sequelize'); const sequelize = require('../../config/db.config'); const mdl_PlanLessons = sequelize.define('PlanLesson', { id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true }, plan_id: { type: DataTypes.BIGINT, allowNull: false }, lesson_id: { type: DataTypes.BIGINT, allowNull: false }, }, { tableName: 'plan_lessons', timestamps: true, paranoid: false, }); module.exports = mdl_PlanLessons;