chore: relocate backend into apps/api ahead of monorepo merge

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 12:20:40 +08:00
co-authored by Claude Sonnet 5
parent af44598df6
commit eaa6d2276a
388 changed files with 0 additions and 13998 deletions
@@ -0,0 +1,30 @@
/***********************************************************************************************************************************************************************
* File Name: user_tier_grants.mdl.js
* Type of Program: Model
* Description: Purchase-time snapshot of the exact courses/units/lessons a
* Tier Plan purchase granted. Replaces live re-resolution off
* plan_courses/plan_units/plan_lessons at access-check time, so
* editing a plan's bundle later no longer retroactively changes
* what past purchasers can access. See hasItemGrant() in
* controllers/client/courses.controller.js.
* Author: Kenneth Obsequio (@lash0000)
* Date Created: Aug. 4, 2026
***********************************************************************************************************************************************************************/
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/db.config');
const mdl_UserTierGrants = sequelize.define('UserTierGrant', {
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
user_tier_id: { type: DataTypes.BIGINT, allowNull: false, label: 'User Tier ID' },
user_id: { type: DataTypes.BIGINT, allowNull: false, label: 'User ID' },
plan_id: { type: DataTypes.BIGINT, allowNull: true, label: 'Plan ID' },
item_type: { type: DataTypes.STRING(10), allowNull: false, label: 'Item Type' },
item_id: { type: DataTypes.BIGINT, allowNull: false, label: 'Item ID' },
granted_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW, label: 'Granted At' },
}, {
tableName: 'user_tier_grants',
timestamps: true,
paranoid: false,
});
module.exports = mdl_UserTierGrants;