/*********************************************************************************************************************************************************************** * File Name: user_tiers.mdl.js * Type of Program: Model * Description: Sequelize model for the `user_tiers` table. * Full history of tier grants per user. * Author: Kenneth Obsequio (@lash0000) * Date Created: Jun. 6, 2026 ***********************************************************************************************************************************************************************/ const { DataTypes } = require('sequelize'); const sequelize = require('../../config/db.config'); const mdl_UserTiers = sequelize.define('UserTier', { tier_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true, label: 'Tier ID' }, user_id: { type: DataTypes.BIGINT, allowNull: false, label: 'User ID' }, tier: { type: DataTypes.STRING(50), allowNull: false, defaultValue: 'free', label: 'Tier' }, status: { type: DataTypes.ENUM('active', 'expired', 'revoked'), allowNull: false, defaultValue: 'active', label: 'Status' }, starts_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW, label: 'Starts At' }, expires_at: { type: DataTypes.DATE, allowNull: true, label: 'Expires At' }, plan_id: { type: DataTypes.BIGINT, allowNull: true, label: 'Plan ID' }, granted_by: { type: DataTypes.BIGINT, allowNull: true, label: 'Granted By' }, revoked_by: { type: DataTypes.BIGINT, allowNull: true, label: 'Revoked By' }, revoked_at: { type: DataTypes.DATE, allowNull: true, label: 'Revoked At' }, notes: { type: DataTypes.TEXT, allowNull: true, label: 'Notes' }, }, { tableName: 'user_tiers', timestamps: true, paranoid: false, }); module.exports = mdl_UserTiers;