Files
starr-philproperties/apps/api/models/tiers/plan_courses.mdl.js
T

28 lines
1.5 KiB
JavaScript

/***********************************************************************************************************************************************************************
* File Name: plan_courses.mdl.js
* Type of Program: Model
* Description: Junction table — links courses to a specific tier plan.
* Composite UNIQUE on (plan_id, course_id) only prevents adding
* the same course twice to the same plan — a course may belong
* to many plans simultaneously (Tier Plans v2, silent duplication
* across bundles is intentional; see admin/tiers.controller.js).
* Bundling/display only, not an access-control mechanism — see
* controllers/client/courses.controller.js (hasItemGrant) /
* user_tier_grants for entitlement.
* Author: Kenneth Obsequio (@lash0000)
* Date Created: Jun. 6, 2026
***********************************************************************************************************************************************************************/
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/db.config');
const mdl_PlanCourses = sequelize.define('PlanCourse', {
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
plan_id: { type: DataTypes.BIGINT, allowNull: false },
course_id: { type: DataTypes.BIGINT, allowNull: false },
}, {
tableName: 'plan_courses',
timestamps: true,
paranoid: false,
});
module.exports = mdl_PlanCourses;