mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
28 lines
1.4 KiB
JavaScript
28 lines
1.4 KiB
JavaScript
/***********************************************************************************************************************************************************************
|
|
* File Name: plan_units.mdl.js
|
|
* Type of Program: Model
|
|
* Description: Junction table — links standalone Units to a specific tier plan.
|
|
* Composite UNIQUE on (plan_id, unit_id) only prevents adding the
|
|
* same unit twice to the same plan — a unit 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 canAccessUnit / user_tier_grants).
|
|
* Author: Kenneth Obsequio (@lash0000)
|
|
* Date Created: Aug. 1, 2026
|
|
***********************************************************************************************************************************************************************/
|
|
const { DataTypes } = require('sequelize');
|
|
const sequelize = require('../../config/db.config');
|
|
|
|
const mdl_PlanUnits = sequelize.define('PlanUnit', {
|
|
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
|
|
plan_id: { type: DataTypes.BIGINT, allowNull: false },
|
|
unit_id: { type: DataTypes.BIGINT, allowNull: false },
|
|
}, {
|
|
tableName: 'plan_units',
|
|
timestamps: true,
|
|
paranoid: false,
|
|
});
|
|
|
|
module.exports = mdl_PlanUnits;
|