new commits

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-03 16:20:58 +08:00
parent 1372f4e975
commit 1d12f04967
93 changed files with 3849 additions and 1063 deletions
+4 -1
View File
@@ -8,6 +8,9 @@
const excludeAttributes = ['provider_payload'];
const jsonbSchemas = {};
const computedAttributes = [];
const computedAttributes = [
{ key: 'user_full_name', label: 'Full Name', type: 'text', order: 1, filterable: false, literal: `("user"."personal_info"->'name'->>'full_name')` },
{ key: 'user.email', label: 'Email Address', type: 'text', order: 2, filterable: false },
];
module.exports = { excludeAttributes, jsonbSchemas, computedAttributes };
+2 -2
View File
@@ -25,13 +25,13 @@ const mdl_Payments = sequelize.define('Payment', {
plan_id: { type: DataTypes.BIGINT, allowNull: false, label: 'Plan ID', hidden: true, order: 2, filterable: true },
tier_id: { type: DataTypes.BIGINT, allowNull: true, label: 'Tier ID', hidden: true, order: 3, filterable: true },
status: { type: DataTypes.ENUM('pending', 'completed', 'failed', 'cancelled', 'expired', 'refunded'), allowNull: false, defaultValue: 'pending', label: 'Status', hidden: false, order: 4, filterable: true },
amount: { type: DataTypes.DECIMAL(10, 2), allowNull: false, label: 'Amount', hidden: false, order: 5, filterable: false },
amount: { type: DataTypes.DECIMAL(10, 2), allowNull: false, label: 'Amount', hidden: false, order: 3, filterable: false },
currency: { type: DataTypes.STRING(10), allowNull: false, defaultValue: 'USD', label: 'Currency', hidden: false, order: 6, filterable: true },
promo_code: { type: DataTypes.STRING(50), allowNull: true, label: 'Promo Code', hidden: false, order: 7, filterable: true },
discount: { type: DataTypes.DECIMAL(10, 2), allowNull: false, defaultValue: 0.00, label: 'Discount', hidden: false, order: 8, filterable: false },
provider: { type: DataTypes.STRING(50), allowNull: false, defaultValue: 'paypal', label: 'Provider', hidden: false, order: 9, filterable: true },
provider_payload: { type: DataTypes.JSONB, allowNull: true, defaultValue: {}, label: 'Provider Payload', hidden: true, order: 10, filterable: false },
paid_at: { type: DataTypes.DATE, allowNull: true, label: 'Paid At', hidden: false, order: 11, filterable: false },
paid_at: { type: DataTypes.DATE, allowNull: true, label: 'Paid At', hidden: false, order: 5, filterable: false },
createdBy: { type: DataTypes.BIGINT, allowNull: true, label: 'Created By' },
updatedBy: { type: DataTypes.BIGINT, allowNull: true, label: 'Updated By' },
deletedBy: { type: DataTypes.BIGINT, allowNull: true, label: 'Deleted By' },
-26
View File
@@ -1,26 +0,0 @@
/***********************************************************************************************************************************************************************
* File Name: plan_prices.mdl.js
* Type of Program: Model
* Description: Admin-managed localized price overrides for tier plans.
* One row per (plan_id, currency) pair. When a user's preferred_currency
* matches a row here, the override price is shown instead of the base price.
* Author: Kenneth Obsequio (@lash0000)
* Date Created: Jun. 29, 2026
***********************************************************************************************************************************************************************/
'use strict';
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/db.config');
const mdl_PlanPrices = sequelize.define('PlanPrice', {
price_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
plan_id: { type: DataTypes.BIGINT, allowNull: false },
currency: { type: DataTypes.CHAR(3), allowNull: false, label: 'Currency' },
price: { type: DataTypes.DECIMAL(10, 2), allowNull: false, label: 'Price' },
}, {
tableName: 'plan_prices',
timestamps: true,
paranoid: false,
});
module.exports = mdl_PlanPrices;
-6
View File
@@ -5,7 +5,6 @@ const mdl_UserTiers = require('./user_tiers.mdl');
const mdl_Payments = require('./payments.mdl');
const mdl_PlanCourses = require('./plan_courses.mdl');
const mdl_PlanPolicies = require('./plan_policies.mdl');
const mdl_PlanPrices = require('./plan_prices.mdl');
const mdl_SystemBadges = require('../system_badges/system_badges.mdl');
const Asset = require('../assets/assets.mdl');
const { Course } = require('../courses/courses.mdl');
@@ -54,10 +53,6 @@ mdl_TierPlans.hasMany(mdl_UserTiers, { foreignKey: 'plan_id', as: 'userTiers'
mdl_TierPlans.hasOne(mdl_PlanPolicies, { foreignKey: 'plan_id', as: 'policy' });
mdl_PlanPolicies.belongsTo(mdl_TierPlans, { foreignKey: 'plan_id', as: 'plan' });
// ─── Plan ↔ Localized Prices ──────────────────────────────────────────────────
mdl_TierPlans.hasMany(mdl_PlanPrices, { foreignKey: 'plan_id', as: 'prices' });
mdl_PlanPrices.belongsTo(mdl_TierPlans, { foreignKey: 'plan_id', as: 'plan' });
// ─── SystemBadge → Asset ─────────────────────────────────────────────────────
mdl_SystemBadges.belongsTo(Asset, { foreignKey: 'asset_id', as: 'asset' });
@@ -68,6 +63,5 @@ module.exports = {
mdl_Payments,
mdl_PlanCourses,
mdl_PlanPolicies,
mdl_PlanPrices,
mdl_SystemBadges,
};