mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
chore: relocate backend into apps/api ahead of monorepo merge
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user