Files
starr-philproperties/models/tiers/plan_units.mdl.js
T
2026-08-01 17:44:25 +08:00

25 lines
1.2 KiB
JavaScript

/***********************************************************************************************************************************************************************
* File Name: plan_units.mdl.js
* Type of Program: Model
* Description: Junction table — links standalone Units to a specific tier plan.
* UNIQUE on unit_id enforces one unit belongs to one plan only.
* Mirrors plan_courses.mdl.js — bundling/display only, not an
* access-control mechanism (see canAccessUnit).
* 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;